57 lines
3.4 KiB
XML
57 lines
3.4 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<helpdocument version="1.0">
|
|
<!--
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
-->
|
|
<meta>
|
|
<topic id="textsbasicshared03170020xml" indexer="include" status="PUBLISH">
|
|
<title id="tit">FormatPercent Function [VBA]</title>
|
|
<filename>/text/sbasic/shared/03170020.xhp</filename>
|
|
</topic>
|
|
</meta>
|
|
<body>
|
|
<section id="formatPercent">
|
|
<bookmark branch="index" id="bm_id661542193659245">
|
|
<bookmark_value>FormatPercent function</bookmark_value>
|
|
</bookmark>
|
|
<h1 id="hd_id871542193473857"><link href="text/sbasic/shared/03170020.xhp">FormatPercent [VBA]</link></h1>
|
|
<paragraph id="par_id351542193473858" role="paragraph">Returns a string with a number formatting applied to a numeric expression. A percent sign is appended to the returned string.</paragraph>
|
|
</section>
|
|
<embed href="text/sbasic/shared/00000003.xhp#vbasupport"/>
|
|
<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
|
|
<bascode>
|
|
<paragraph role="bascode" id="par_id291542194090512" localize="false">FormatPercent( expression, [numDigitsAfterDecimal As Integer], [includeLeadingDigit As Integer], _</paragraph>
|
|
<paragraph role="bascode" id="bas_id651676032533813" localize="false"> [useParensForNegativeNumbers As Integer], [groupDigits As Integer] ) As String</paragraph>
|
|
</bascode>
|
|
<embed href="text/sbasic/shared/03170010.xhp#ReturnAndParms"/>
|
|
<embed href="text/sbasic/shared/00000003.xhp#errorcode"/>
|
|
<embed href="text/sbasic/shared/00000003.xhp#err13"/>
|
|
<embed href="text/sbasic/shared/00000003.xhp#functexample"/>
|
|
<bascode>
|
|
<paragraph role="bascode" id="par_id381542204697430" localize="false">Sub TestFormatNumber</paragraph>
|
|
<paragraph role="bascode" id="par_id551542204266762" localize="false"> Const UseComputerRegionalSettings = -1</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id771542204286220"> MsgBox FormatPercent(12.2, NumDigitsAfterDecimal:=2) ' 1220.00% if selected user interface is english</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id671542204307459"> MsgBox FormatPercent("-,2", 2, IncludeLeadingDigit:=vbTrue) ' -20,00% if french user interface</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id61542204328859"> MsgBox FormatPercent("-0.2", 2) ' -20.00% for en-US, -0,00 for fr-CA, de-AT or pt-BR</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id421542204347269"> MsgBox FormatPercent(-0.2, UseComputerRegionalSettings, UseParensForNegativeNumbers:=vbTrue) ' (20,00)% if pt-BR</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id151542204366706"> MsgBox FormatPercent("-0,2", UseComputerRegionalSettings, vbUseDefault, vbTrue) ' (20,00)% if german</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id971542204385212"> MsgBox FormatPercent("-12345678", -1, vbUseDefault, vbUseDefault, GroupDigits:=vbTrue) ' -1 234 567 800,00% for fr-BE</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id11542204687786" localize="false">End Sub</paragraph>
|
|
</bascode>
|
|
<section id="relatedtopics">
|
|
<embed href="text/sbasic/shared/00000003.xhp#VBAMath"/>
|
|
</section>
|
|
</body>
|
|
</helpdocument>
|