FormatPercent 函数FormatPercent function

返回格式设置为带有尾随 % 字符的百分比(乘以 100)的表达式。Returns an expression formatted as a percentage (multipled by 100) with a trailing % character.


FormatPercent(Expression、[ NumDigitsAfterDecimal, [ IncludeLeadingDigit, [ UseParensForNegativeNumbers, [ GroupDigits ]]]])FormatPercent(Expression, [ NumDigitsAfterDecimal, [ IncludeLeadingDigit, [ UseParensForNegativeNumbers, [ GroupDigits ]]]])

FormatPercent 函数的语法包含以下部分:The FormatPercent function syntax has these parts:

PartPart 说明Description
ExpressionExpression 必需。Required. 要格式化的表达式。Expression to be formatted.
NumDigitsAfterDecimalNumDigitsAfterDecimal 可选。Optional. 指示要显示的小数点右侧的位数的数值。Numeric value indicating how many places to the right of the decimal are displayed. 默认值为-1, 表示使用计算机的区域设置。Default value is -1, which indicates that the computer's regional settings are used.
IncludeLeadingDigitIncludeLeadingDigit 可选。Optional. 指示是否为小数值显示前导零的三态常数。Tristate constant that indicates whether or not a leading zero is displayed for fractional values. 请参阅“设置”部分以了解各个值。See Settings section for values.
UseParensForNegativeNumbersUseParensForNegativeNumbers 可选。Optional. 指示是否在圆括号内放置负值的三态常数。Tristate constant that indicates whether or not to place negative values within parentheses. 请参阅“设置”部分以了解各个值。See Settings section for values.
GroupDigitsGroupDigits 可选。Optional. 三态常量, 指示是否使用计算机的区域设置中指定的组分隔符对数字进行分组。Tristate constant that indicates whether or not numbers are grouped by using the group delimiter specified in the computer's regional settings. 请参阅“设置”部分以了解各个值。See Settings section for values.


IncludeLeadingDigitUseParensForNegativeNumbersGroupDigits 参数包含以下设置:The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the following settings:

常量Constant Value 说明Description
vbTruevbTrue -1-1 TrueTrue
vbFalsevbFalse 00 FalseFalse
vbUseDefaultvbUseDefault -2-2 使用计算机的区域设置中的设置。Use the setting from the computer's regional settings.


当省略了一个或多个可选参数时,被省略的参数的值由计算机的区域设置提供。When one or more optional arguments are omitted, the values for omitted arguments are provided by the computer's regional settings.


所有设置均来自“区域设置数”**** 选项卡。All settings information comes from the Regional Settings Number tab.

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.