VBS Tutorial: function-FormatCurrency Function

Source: Internet
Author: User

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 .

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.