FormatCurrency Function
Return expression, which has been formatted as a currency value (using the currency symbol defined in the system control panel ).
FormatCurrency(
expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]]
)
Parameters
Expression
Required. The expression to be formatted.
NumDigitsAfterDecimal
Optional. The number of digits to the right of the decimal point. The default value is-1, indicating that the computer's regional settings are used.
IncludeLeadingDigit
Optional. A three-state constant that indicates whether to display zero before the decimal point of a small number. For values, see the "Settings" section.
UseParensForNegativeNumbers
Optional. A three-state constant that indicates whether to place a negative value in parentheses. For values, see the "Settings" section.
GroupDigits
Optional. A three-state constant that indicates whether to use the numeric grouping symbol specified in the computer region settings to group numbers. For values, see the "Settings" section.
Set
The deleadingdigit, UseParensForNegativeNumbers, and GroupDigits parameters can have the following values:
Constant |
Value |
Description |
TristateTrue |
-1 |
True |
TristateFalse |
0 |
False |
TristateUseDefault |
-2 |
Use settings in computer region settings. |
Description
When one or more optional parameters are omitted, the value of the omitted parameter is provided by the computer region settings. The location of the currency symbol associated with the currency value is determined by the system region settings.
Note:Except for the "show start zero" option that comes from the "Number" tab of the region settings, all other settings are taken from the "currency" tab of the region settings.
The following example usesFormatCurrencyThe function formats the expression to currency and assigns it to MyCurrency:
Dim MyCurrencyMyCurrency = FormatCurrency(1000) 'MyCurrency
Include $1000.00
.