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

Replace Var Type With Value Function
Convert Values Class

Public Function ReplaceVarTypeWithValue( _
      ByVal vOriginal As Variant _
    , ByVal vVarType As Variant _
    , ByVal vReplace As Variant _
    ) As Variant

"Replace All Values Of A Specific Type With Another Value"
Replaces all values which have a specific data type with another value.
Returns all other values unchanged.
Generally only supports numeric and string values.

Examples:
    ReplaceVarTypeWithValue(1, vbString, Null) = 1
    ReplaceVarTypeWithValue(1, vbInteger, "Int") = "Int"
    ReplaceVarTypeWithValue("Int", vbString, 0) = 0
    ReplaceVarTypeWithValue(Null, vbNull, "") = ""
See also:
    ReplaceValue Function
    ReplaceValueOfType Function
    vbArray Property, et. al.
    VarType Function (Visual Basic)
vOriginal: The value whose data type is checked to see if it matches vVarType. Function returns vReplace if the data type of vOriginal matches vVarType. Function returns vOriginal otherwise. vOriginal must be an Empty, Null, numeric, String, or Array value.
vVarType: One of the vb constants that represents a Visual Basic data type. vOriginal values of this data type will be replaced by vReplace.
vReplace: The value which is returned instead of vOriginal if the VarType of vOriginal is vVarType. vReplace must be an Empty, Null, numeric, String, or Array value.
Note: Example #4 is the same as the NullToBlank function.
Note: This function is a more generalized version of the BlankToValue, EmptyToValue, and NullToValue functions.

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