forked from amazingfate/help
Change-Id: I67540e5f1feec3baa6d585a508fc5b270c0981ae Reviewed-on: https://gerrit.libreoffice.org/c/help/+/147241 Tested-by: Jenkins Reviewed-by: Alain Romedenne <alain.romedenne@libreoffice.org>
58 lines
3.7 KiB
XML
58 lines
3.7 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" xml-lang="en-US">FormatPercent Function [VBA]</title>
|
|
<filename>/text/sbasic/shared/03170020.xhp</filename>
|
|
</topic>
|
|
</meta>
|
|
<body>
|
|
<section id="formatPercent">
|
|
<bookmark id="bm_id541542193473856" xml-lang="en-US" branch="hid/zzzz" localize="false"/>
|
|
<bookmark xml-lang="en-US" branch="index" id="bm_id661542193659245">
|
|
<bookmark_value>FormatPercent function</bookmark_value>
|
|
</bookmark>
|
|
<h1 id="hd_id871542193473857" xml-lang="en-US"><link href="text/sbasic/shared/03170020.xhp">FormatPercent [VBA]</link></h1>
|
|
<paragraph id="par_id351542193473858" role="paragraph" xml-lang="en-US">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" xml-lang="en-US" localize="false">Sub TestFormatNumber</paragraph>
|
|
<paragraph role="bascode" id="par_id551542204266762" localize="false"> Const UseComputerRegionalSettings = -1</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id771542204286220" xml-lang="en-US"> MsgBox FormatPercent(12.2, NumDigitsAfterDecimal:=2) ' 1220.00% if selected user interface is english</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id671542204307459" xml-lang="en-US"> MsgBox FormatPercent("-,2", 2, IncludeLeadingDigit:=vbTrue) ' -20,00% if french user interface</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id61542204328859" xml-lang="en-US"> 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" xml-lang="en-US"> MsgBox FormatPercent(-0.2, UseComputerRegionalSettings, UseParensForNegativeNumbers:=vbTrue) ' (20,00)% if pt-BR</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id151542204366706" xml-lang="en-US"> MsgBox FormatPercent("-0,2", UseComputerRegionalSettings, vbUseDefault, vbTrue) ' (20,00)% if german</paragraph>
|
|
|
|
<paragraph role="bascode" id="par_id971542204385212" xml-lang="en-US"> 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> |