End Function
FixUpVariantToStringSub FixUps Sub -- Entisoft Tools 2.0 Object Library

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

Fix Up Variant To String Sub Sub
Fix Ups Class

Public Sub FixUpVariantToStringSub( _
      ByRef rArgument As Variant _
    , ByVal vDefault As Variant _
    )

"Fix Up Variant To String Subroutine"
Leave string values as-is, and convert numeric or date arguments into string values.
Assign the default value vDefault to the argument rArgument if conversion is not possible.

Top20: This function is among our "top-twenty" most useful.
See also:
    FixUpVariantToStringFn Function
Summary: Represent any type of variant argument as a string using its default format. Set the argument to the default value when the argument is Null.
Similar to the NullToBlank function, except that non-null arguments are converted to strings and Null arguments are replaced by the default value instead of an empty string.
rArgument: The argument which is changed to a String value, if possible. Subroutine assigns the default vDefault to rArgument if conversion was not possible, such as when the rArgument is missing, Null, an array, an error, or an object.
Note: rArgument is a passed by reference, so the variable passed from the calling function will likely be modified.
vDefault: The default value which is assigned to rArgument when conversion is not possible.
Note: The default value can be a data type other than String as long as it is compatible with the variable passed via rArgument.

Example:

    Function LeftJustify(ByVal vValue As Variant, Optional ByVal vFillString As Variant) As Variant
        FixUpVariantToStringSub vFillString, " "
        If Not FixUpVariantToStringFn(vValue) Then
            LeftJustify = Null
            Exit Function
        End If
        ' Other code here.

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