Function Array Conversions Class

StringVectorToVariantVector

Convert a String vector into a Variant vector. Copies each of the elements of a one-dimensional String array into a one-dimensional array of Variant values.

Signature (Visual Basic / VBA)

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

Code Example

    Assuming
       Static astrNames(0 To 2) As String
       astrNames(1) = "Car"
       Dim avarNames() As Variant
    for example
       StringVectorToVariantVector(avarNames(), astrNames()) = True
    leaves
       LBound(avarNames) = 0
       UBound(avarNames) = 2
       avarNames(0) = ""
       avarNames(1) = "Car"
       avarNames(2) = ""

Parameters

Parameter Description
rTo Dynamic array of Variants that will be dimensioned with one dimension before it receives copy of each of the elements in vFm.
vFm One-dimensional array of (variable-length) String values that will be copied to array rTo.

Return Value

Function currently always returns True.