Sub Fix Ups Class

FixUpVariantCompare

Fix up the Compare argument required by many functions. The Compare argument specifies the string comparison type and/or sort order/collating sequence for the function.

Signature (Visual Basic / VBA)

Public Sub FixUpVariantCompare( _
    ByRef rCompare As Variant _
    )

Code Examples

    Assuming
       Dim varTemp As Variant
       varTemp = vbTextCompare
    for example
       FixUpVariantCompare varTemp
    leaves
       varTemp = vbTextCompare
    Assuming
       Dim varTemp As Variant
       varTemp = Null
    for example
       FixUpVariantCompare varTemp
    leaves
       varTemp = vbBinaryCompare
    FixUpVariantCompare vCompare
    FixUpVariantToLongMandSub vCompare, vbBinaryCompare

Parameters

Parameter Description
rCompare A Variant whose value is assumed to represent one of the string comparison types or collating sequences. If rCompare is numeric or a numeric string, it is converted to an Long. rCompare is assigned to the value of the Application Class Compare Property in the following circumstances: 1) if rCompare is Null, 2) if rCompare cannot be fixed up to a number, or 3) if rCompare was missing within the function that called this one.

Notes & Version History

Summary Numeric values are converted to Long data type values. Other non-numeric values replaced with vbBinaryCompare.
Note The following subroutine calls are equivalent:
Note This function will always modify its rCompare argument (unless it generates a runtime error because the argument was a number not within the range allowed for Long values).
v1.3 Change This subroutine no longer uses the value of the Application Class Compare Property. It now sets the argument to vbBinaryCompare when the argument is not a valid Long number.