Public Sub FixUpVariantToBooleanMandSub( _ ByRef rArgument As Variant _ , ByVal vDefault As Variant _ )
FixUpVariantToBooleanMaybeSub Subroutine FixUpVariantToBooleanMandFn FunctionrArgument: The argument which is changed to a Boolean value, if possible. Subroutine assigns the default vDefault to rArgument if conversion was 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 FixUpVariantToBooleanMandSub varFlag, True leaves varFlag = False VarType(varFlag) = vbBooleanExample #2:
Assuming Dim varFlag2 As Variant varFlag2 = "Word" for example FixUpVariantToBooleanMandSub varFlag2, True leaves varFlag2 = TrueExample #3:
Assuming Dim varFlag3 As Variant varFlag3 = "Word" for example FixUpVariantToBooleanMandSub varFlag3, Null leaves IsNull(varFlag3) = True
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.