Public Sub FixUpVariantToBooleanMaybeSub( _ ByRef rArgument As Variant _ , ByVal vDefault As Variant _ )
FixUpVariantToBooleanMandSub Subroutine FixUpVariantToBooleanMaybeFn FunctionrArgument: Argument that is checked for compatibility with the Boolean data type. Argument will actually be converted to a Boolean value if it is a numeric string or date/time string. Subroutine assigns the default value vDefault to rArgument if conversion is not possible, such as when the rArgument is out-of-range, missing, Null, an error, a pointer, or a non-numeric string.
Example #1:
Assuming Dim varFlag As Variant varFlag = "0" for example FixUpVariantToBooleanMaybeSub varFlag, True leaves varFlag = False VarType(varFlag) = vbBooleanExample #2:
Assuming Dim varFlag2 As Variant varFlag2 = 0 for example FixUpVariantToBooleanMaybeSub varFlag2, True leaves varFlag2 = 0 VarType(varFlag2) = vbIntegerExample #3:
Assuming Dim varFlag3 As Variant varFlag3 = "Word" for example FixUpVariantToBooleanMandSub varFlag3, True leaves varFlag3 = True varType(varFlag3) = vbBoolean
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.