Public Function CoerceToVarType( _
ByVal vString As Variant _
, ByVal vVarType As Variant _
) As Variant CoerceToVarType(Chr$(1) + Chr$(1), vbInteger) = 257%
CoerceToVarType(Chr$(1) + Chr$(1) + Chr$(0) + Chr$(0), vbLong) = 257&
CoerceToVarType(Chr$(1) + Chr$(1), vbInteger) = CoerceToInteger(Chr$(1) + Chr$(1))See also: MakeVarType Function
CoerceToBoolean Function
CoerceToByte Function
CoerceToCurrency Function
CoerceToDate Function
CoerceToDouble Function
CoerceToInteger Function
CoerceToLong Function
CoerceToSingle FunctionvString: The string whose leading characters are to be interpreted as the data type identified by vVarType. Note: Function generates the Visual Basic Error "Illegal Function Call" if vString is shorter than the data type to which it is being coerced.
Note: Function uses the leftmost characters in vString when it is longer than target data type.
Note: This function first converts the string from Unicode to the default code page of the system (in most cases except for that of the Coercion to a Byte).
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.