Sub Fix Ups Class

FixUpVariantToDateMaybeSub

"Fix Up Variant To Date Maybe Subroutine" Assign the value vDefault to rArgument if rArgument cannot be converted to a Date value. Numeric strings and date/time strings are converted into Date values. Other numeric values are left as-is.

Signature (Visual Basic / VBA)

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

Parameters

Parameter Description
rArgument Argument that is checked for compatibility with the Date data type. Argument will actually be converted to a Date 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.
vDefault The default value which is assigned to rArgument when conversion is not possible.

Notes & Version History

Note rArgument is a passed by reference, so the variable passed from the calling function may be modified.
Note The default value can be a data type other than Date as long as it is compatible with the variable passed via rArgument.