| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Program Files/LibreOffice/help/en-US/text/sbasic/shared/ |
Upload File : |
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<base href="../../../../">
<noscript><meta http-equiv="refresh" content="0; URL=../../../../en-US/noscript.html"></noscript>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Option Compatible</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="en-US/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="en-US/bookmarks.js" defer></script><script type="text/javascript" src="en-US/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="en-US/text/shared/05/new_help.html"><div></div></a><a class="logo" href="en-US/text/shared/05/new_help.html"><p dir="auto">LibreOffice 24.2 Help</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Module</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contents</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Search in bookmarks for chosen module" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<a name="N8803"></a>
<meta itemprop="keywords" content="Option Compatible">
<a name="optioncompatiblestatement"></a>
<h1 id="N0104" dir="auto">
<a name="compatiblestatement"></a>Option Compatible Statement</h1>
<p id="N0106" class="paragraph" dir="auto"><span class="literal">Option Compatible</span> extends LibreOffice Basic compiler and runtime, allowing supplemental language constructs to Basic.</p>
<div class="embedded">
<a name="beforeexecutable"></a>
<div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id3145172" dir="auto">This statement must be added before the executable program code in a module.</p></div>
</div>
<br>
</div>
<p id="N0107" class="paragraph" dir="auto">This option may affect or assist in the following situations:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="N0108" class="listitem" dir="auto">Allow special characters as identifiers. all characters that are defined as
letter in the Latin-1 (ISO 8859-1) character set, are accepted
as part of identifiers.</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="N0109" class="listitem" dir="auto">Create <a target="_top" href="en-US/text/sbasic/shared/03040000.html#addvbaconstants">VBA constants including non-printable characters</a>.</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="N0110" class="listitem" dir="auto">Allow the <span class="literal">New</span> operator to be optional in <span class="literal">Dim</span> statements.</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="N0112" class="listitem" dir="auto">Allow default values for optional parameters in procedures.</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="N0113" class="listitem" dir="auto">Use named arguments when multiple optional parameters exist.</p></li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto"><p id="N0114" class="listitem" dir="auto">Preload of LibreOffice Basic libraries</p></li>
</ul>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="N0115" dir="auto"><span class="literal">Option Compatible</span> is required when coding class modules.</p></div>
</div>
<br>
<div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
<p id="N0117" class="code" dir="auto">Option Compatible</p>
<div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
<h3 id="hd_id231561639199292" dir="auto">Special characters as identifiers</h3>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
Option Compatible
' With this option the code works, otherwise it causes a compiling error
Sub Main
ä = 10
print ä
End Sub
</code></pre></div>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id381561650119146" dir="auto">Statement <span class="literal">Option VBAsupport 1</span> implies <span class="literal">Option Compatible</span> statement automatically.</p></div>
</div>
<br>
<a name="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a name="related"></a><span class="emph">Related Topics</span>
</p>
<div class="relatedbody" itemprop="mentions">
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03090407.html">Rem Statement</a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/compatibilitymode.html">CompatibilityMode() Function</a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103200.html">Option Base Statement</a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103300.html">Option Explicit Statement</a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03103350.html">Option VBASupport Statement</a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/classmodule.html">Option ClassModule Statement</a></p></div>
<p id="N0131" class="paragraph" dir="auto">Variables scope modification in <a target="_top" href="en-US/text/sbasic/shared/01020300.html">Using Procedures and Functions</a> with <span class="literal">CompatibilityMode()</span> function.</p>
<p id="N0129" class="paragraph" dir="auto">Refer to <a target="_top" href="en-US/text/sbasic/python/python_platform.html">Identifying the Operating System</a> and <a target="_top" href="en-US/text/sbasic/python/python_session.html">Getting Session Information</a> for class module examples, or <a target="_top" href="en-US/text/sbasic/guide/access2base.html">Access2Base shared Basic library</a> for other class examples making use of <span class="literal">Option Compatible</span> compiler mode.</p>
</div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/compatible.xhp" target="_blank">/text/sbasic/shared/compatible.xhp</a></p>
<p dir="auto">Title is: Option Compatible</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>