DIAdem Help

Method: FormatCurrency for VBS

  • Updated2024-09-12
  • 1 minute(s) read

Method: FormatCurrency for VBS

Formats a currency amount with the currency symbol specified in the control panel.

vFormatCurrency = Object.FormatCurrency(expression, [NumDigitsAfterDecimal], [IncludeLeadingDigit], [UseParensForNegativeNumbers], [GroupDigits])
ObjectVBS
Object with this method. You do not need to specify this object.
expressionVariant
Specifies the expression to be formatted.
[NumDigitsAfterDecimal]Variant
Specifies the number of decimal places behind the decimal separator. If you do not specify a value, the FormatCurrency method uses the value -1, which means that the method uses the regional settings of your computer.
[IncludeLeadingDigit]Variant
Specifies whether the FormatCurrency method displays leading zeros. Valid values are vbTrue, vbFalse, and vbUseDefault.
[UseParensForNegativeNumbers]Variant
Specifies whether the FormatCurrency method displays negative numbers in parentheses. Valid values are vbTrue, vbFalse, and vbUseDefault.
[GroupDigits]Variant
Specifies whether the FormatCurrency method groups numbers. Valid values are vbTrue, vbFalse, and vbUseDefault.
vFormatCurrencyVariant
Receives the formatted currency amount.

The following example displays various formats for a currency amount:

Dim MyNumber 
MyNumber = -12345.6789
Call MsgBox(FormatCurrency (MyNumber))
' Do not group digits
Call MsgBox(FormatCurrency (MyNumber, , , , vbFalse))

See Also

Objects Overview

Related Topics

FormatCurrency | FormatDateTime | FormatNumber | FormatPercent