<-- Previous || Up || Next -->

Copy Variant Array Function
Array Manipulations Class

Public Function CopyVariantArray( _
      ByRef rTo() As Variant _
    , ByRef vFm() As Variant _
    ) As Boolean

Copy a Variant array to another Variant array.
Source array can have 1, 2, or 3 dimensions.

Example #1:
       Static avarIn(0 To 45) As Variant
       avarIn(1) = "Smith"
       Dim avarOut() As Variant
    for example
       CopyVariantArray(avarOut(), avarIn()) = True
Example #2:
       Static avarIn(0 To 45, 0 To 67) As Variant
       avarIn(1, 1) = "Smith"
       Dim avarOut() As Variant
    for example
       CopyVariantArray(avarOut(), avarIn()) = True
See also:
    CopyVariantArrayDirect Function (direct-copy version)
    CopyVariantVector Function (for one-dimensional arrays)
    CopyVariantMatrix Function (for two-dimensional arrays)
    CopyVariantCube Function (for three-dimensional arrays)
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.
Note: Function makes a temporary copy of the source array so that rTo and vFm can be the same.
Return value: Function currently returns True in all cases.
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.

Return to ENTISOFT Home Page

Copyright 1999-2005 Entisoft