Signature (Visual Basic / VBA)
Public Function CopyVariantArrayDirect( _
ByRef rTo() As Variant _
, ByRef vFm() As Variant _
) As Boolean
Code Examples
Assuming
Static avarIn(0 To 45) As Variant
avarIn(1) = "Smith"
Dim avarOut() As Variant
for example
CopyVariantArrayDirect(avarOut(), avarIn()) = True
Assuming
Static avarIn(0 To 45, 0 To 67) As Variant
avarIn(1, 1) = "Smith"
Static avarOut(0 To 45, 0 To 67) As Variant
for example
CopyVariantArrayDirect(avarOut(), avarIn()) = True
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 have the same number of dimensions and dimension bounds as vFm. |
| vFm | The one-, two-, or three-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 returns True upon success and False upon failure.
Notes & Version History
| Warning | Function assumes that rTo and vFm are different arrays. If they are not, and if vFm/rTo is dynamic, then the contents of vFm will be lost. |
| 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. |