Function Convert Values Class

VariantToVariantString

"Variant Value To Variant String" or "Variant String From Variant Value" Represents any type of value as a "Variant String." For the purposes of this function, a "Variant String" is one which represents some type of value and also contains information about the type of value being represented. Inverse of the VariantStringToVariant function.

Signature (Visual Basic / VBA)

Public Function VariantToVariantString( _
    ByVal vValue As Variant _
    ) As String

Code Example

    VariantToVariantString(CInt(2)) = Chr$(2) + Chr$(2) + Chr$(0)
    VariantToVariantString(CLng(2)) = Chr$(3) + Chr$(2) + Chr$(0) + Chr$(0) + Chr$(0)

Parameters

Parameter Description
vValue The value which is to be coerced into a string and returned along with information about the type of the original value.

Notes & Version History

Details This function will create a string that can be converted back into the original type of value without requiring the type information to be stored independently. It uses the appropriate Make function to encode the internal representation of a value along with information about the data type of the value.