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

Variant To VB Eval Expression Function
Convert Values Class

Public Function VariantToVBEvalExpression( _
    ByVal vValue As Variant _
    ) As String

"Variant To Visual Basic Eval Expression"
Return the string representation of any type of value as it would appear within a Visual Basic (non-Const) expression.
Converts the value of a variant into a string that can be passed to the Eval function (in Access and Excel only).

Examples:
    VariantToVBEvalExpression(False) = "False"
    VariantToVBEvalExpression(CInt(2)) = "2%"
    VariantToVBEvalExpression(CSng(2)) = "2!"
    VariantToVBEvalExpression(CByte(2)) = "CByte(2)" ' #4
    VariantToVBEvalExpression(#4/5/96#) = "#4/5/96#"
    VariantToVBEvalExpression("Word") = """Word"""
    VariantToVBEvalExpression(Null) = "Null"
See also:
    VariantToVBConstExpression Function
    EqualQuotedValue Function
Note: Bytes represented with the CByte() function as in example #4.

vValue: The value which is to be converted to its representation within Visual Basic expressions. Function generates an error when passed things like object pointers which have no string representation.
v1.5 Change: This function has been extended to support the new Decimal data type in VB 6.0,

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