VARIANT# function

Purpose

Return the numeric value contained in a Variant variable.

Syntax

numericvar = VARIANT#(vrntvar)

Remarks

The value returned by VARIANT# may be any range from BYTE to DOUBLE/QUAD/CURRENCY, depending upon the internal representation used within the Variant.

While Variant variables, by definition, do not offer support for Extended Precision Float data types, you should note that it is possible for a QUAD or CURRENCY value to exceed the precision level offered by a DOUBLE.  You should therefore use some judgement in deciding on the numeric variable type to be used as the destination of this function, based upon the expected return values, and the internal representation, which you can obtain with VARIANTVT.

Restrictions

VARIANT# presumes that a valid numeric value is present (not an array); otherwise, the value zero is returned.

See also

DIM, LET, OBJECT, LET (with Variants), VARIANT$, VARIANT$$, VARIANTVT

Example

DIM vVnt AS VARIANT

vVnt = 999&

a& = VARIANT#(vVnt)