CCur Function

Description

Converts an expression to a Currency.

Syntax

CCur(expression)

The expression argument is any valid numeric or string expression.

Remarks

In general, you can document your code using the data type conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CCur to force currency arithmetic in cases where single-precision, double-precision, or integer arithmetic normally would occur.

You should use the CCur function instead of Val to provide internationally-aware conversions from any other data type to a Currency. For example, different decimal separators are properly recognized depending on the locale setting of your computer, as are different thousand separators and various currency options.

If expression lies outside the acceptable range for the Currency data type, an error occurs.

See Also

Data Type Summary.

Example

This example uses the CCur function to convert an expression to a Currency.


MyDouble = 543.214588    ' MyDouble is a Double.

MyCurr = CCur(MyDouble * 2)    ' Convert result (1086.4292) to 
    ' Currency.