Function Convert Values Class

VariantStringToVariant

"Variant String To Variant Value" or "Variant Value From Variant String" Converts from a "Variant String" back to the original value. 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 VariantToVariantString function.

Signature (Visual Basic / VBA)

Public Function VariantStringToVariant( _
    ByVal vValue As Variant _
    ) As Variant

Code Example

    Assuming
       Dim strIntTwo As String
       strIntTwo = Chr$(2) + Chr$(2) + Chr$(0)
       Dim strLngTwo As String
       strLngTwo = Chr$(3) + Chr$(2) + Chr$(0) + Chr$(0) + Chr$(0)
    for example
       VariantStringToVariant(strIntTwo) = 2%
       VarType(VariantStringToVariant(strIntTwo)) = vbInteger
       VariantStringToVariant(strLngTwo) = 2&
       VarType(VariantStringToVariant(strLngTwo)) = vbLong

Parameters

Parameter Description
vValue The string containing the internal representation of some value along with the type of the value. Function returns an empty string vValue is an empty string.

Notes & Version History

Summary This function will convert a string created by the VariantToVariantString function back to its original value and data type.