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

Var Type From String Function
Comparisons Class

Public Function VarTypeFromString( _
    ByVal vVarType As Variant _
    ) As Variant

"Variable Type From String" or "String To Variable Type"
Converts the name of a data type into the VarType value representing that data type.

Examples:
    VarTypeFromString("String") = vbString
    VarTypeFromString("STRING") = vbString
    VarTypeFromString("LONG") = vbLong
    VarTypeFromString("variant ARRAY") = vbVariant + vbArray
    IsNull(VarTypeFromString("Unknown")) = True
See also:
    VarTypeToString Function
    vbArray Property, et. al.
    VarType Function (Visual Basic)
vVarType: The name of a Visual Basic data type whose VarType value is to be returned. Function returns Null if vVarType is Null or cannot be fixed up to a String. Function returns Null if vVarType is not the name of a Visual Basic data type.

Note: The match is case-insensitive, so it does not matter if the data type name is in upper- or lower-case.

v1.2 BugFix: Changed function to correctly recognize arrays of types other than Variant. Arrays are now identified by names like "Currency Array" or "Variant Array".
v1.5 Change: This function has been extended to support the new Decimal data type in VB 6.0.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.