Signature (Visual Basic / VBA)
Public Function CopyVariantMatrix( _
ByRef rTo() As Variant _
, ByRef vFm() As Variant _
) As Boolean
Code Examples
Assuming
Static avarIn(0 To 45, 0 To 12) As Variant
avarIn(1, 1) = "Smith"
Dim avarOut() As Variant
for example
CopyVariantMatrix(avarOut(), avarIn()) = True
rTo vFm
+----+----+----+ +----+----+----+
| 12 | 34 | WV | <-- | 12 | 34 | WV |
+----+----+----+ +----+----+----+
| 21 | 43 | CA | | 21 | 43 | CA |
+----+----+----+ +----+----+----+
Parameters
| Parameter | Description |
|---|---|
| rTo | Destination array that will receive a copy of array vFm. This function will attempt to re-dimension rTo so that it has the same dimensions as vFm. It will ignore errors during that re-dimension so that rTo can be a Static array. If rTo is Static, it must be two-dimensional and have the same upper and lower bounds as vFm. |
| vFm | The two-dimensional array of Variants that will be copied to rTo. vFm can be either Static or dynamic. If vFm is dynamic, it must be dimensioned before being passed to this function. |
Return Value
Function currently returns True in all cases.
Notes & Version History
| Note | Function makes a temporary copy of the source array so that rTo and vFm can be the same. |
| v1.2 Change | Changed to allow rTo to be Static by making the function ignore errors that occur while re-dimensioning the destination array rTo. |