Convert Expression to Variant Method

The Convert Expression to Variant method converts an expression to a variant. It returns this variant. It accepts any type of expression. It creates the same result that assigning the expression to a variant variable creates.

Format

CVar(expression)

For information about the arguments that you can use with this method, see Argument That You Can Use with Conversion Methods.

Example

The following example converts a single variable to a variant variable:

Sub Button_Click
   Dim singleAnswer as Single
   Dim variantAnswer as Variant
   singleAnswer = 100.5
   variantAnswer = CVar(singleAnswer )
end Sub