Skip to main content

CCur

Returns an expression that has been converted to a Variant of subtype Currency.

Structure

CCur(expression)

Parameters

The expression argument is any valid expression.

Description

In general, you can document your code using the subtype 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 integer arithmetic normally would occur.

You should use the CCur function to provide internationally aware conversions from any other data type to a Currency subtype. For example, different decimal separators and thousands separators are properly recognized depending on the locale setting of your system.

Example

The following example uses the CCur function to convert an expression to a Currency:

Dim MyDouble, MyCurr

MyDouble = 543.214588 ' MyDouble is a Double.

MyCurr = CCur(MyDouble * 2) ' Convert result of MyDouble * 2 (1086.429176) |