FormatCurrency function
Returns an expression that 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 option. The expression to be formatted.
Numdigitsafterdecimal
Options available. A numeric value indicating the number of digits displayed to the right of the decimal point. The default value is-1, which indicates that the computer's locale is being used.
IncludeLeadingDigit
Options available. A three-state constant that indicates whether to display a decimal value of 0 in the front. For numeric values, see the "Settings" section.
UseParensForNegativeNumbers
Options available. A three-state constant that indicates whether negative values are placed in parentheses. For numeric values, see the "Settings" section.
GroupDigits
Options available. A three-state constant that indicates whether numbers are grouped by using the numeric grouping symbols specified in the computer locale. For numeric values, see the "Settings" section.
Set up
The IncludeLeadingDigit, useparensfornegativenumbers, and GroupDigits parameters can have the following values:
Constants |
value |
Description |
TristateTrue |
-1 |
True |
Tristatefalse |
0 |
False |
Tristateusedefault |
-2 |
Use the settings in your computer's regional settings. |
Description
When one or more optional arguments are omitted, the computer locale provides the value of the omitted parameter. The position of the currency symbol associated with the currency value is determined by the locale setting of the system.
Note All other settings information is taken from the Currency tab of the locale, except for the "show starting 0" setting from the "Number" tab from the locale.
The following example uses the formatcurrency function to format expression as currency and assign to Mycurrency:
Dim mycurrencymycurrency = FormatCurrency ( 1000 ) " Mycurrency
contains $1000.00
.