This topic has not yet been rated - Rate this topic

CCur Function 

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



CCur(expression)

The expression argument is any valid expression.

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.

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) to a Currency (1086.4292).
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ