CCur Function

Office VBScript

Microsoft® Visual Basic® Scripting Edition CCur Function  Language Reference 
Version 1 


Description
Returns an expression that has been converted to a Variant of subtype Currency.
Syntax
CCur(expression)

The expression argument is any valid expression.

Remarks
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).