Signature (Visual Basic / VBA)
Public Sub FixUpVariantToStringSub( _
ByRef rArgument As Variant _
, ByVal vDefault As Variant _
)
Code 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.
Parameters
| Parameter | Description |
|---|---|
| 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. |
| vDefault | The default value which is assigned to rArgument when conversion is not possible. |
Notes & Version History
| 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. |
| Note | rArgument is a passed by reference, so the variable passed from the calling function will likely be modified. |
| Note | The default value can be a data type other than String as long as it is compatible with the variable passed via rArgument. |