summaryrefslogtreecommitdiff
path: root/source/text/sbasic/shared/compatible.xhp
blob: d533ceaf72d502b7f137b70ecce1ba7d2983684a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?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="text/sbasic/shared/compatible">
            <title id="tit" xml-lang="en-US">Option Compatible</title>
            <filename>/text/sbasic/shared/compatible.xhp</filename>
        </topic>
    </meta>
    <body>
    <bookmark branch="index" id="N0103">
        <bookmark_value>Option Compatible</bookmark_value>
        <bookmark_value>CompatibilityMode</bookmark_value>
        <bookmark_value>VBA compatibility</bookmark_value>
    </bookmark>

    <section id="optioncompatiblestatement">
        <h1 id="N0104"><variable id="compatiblestatement"><link href="text/sbasic/shared/compatible.xhp" name="compatible">Option Compatible Statement</link></variable></h1>
        <paragraph role="paragraph" id="N0106"><literal>Option Compatible</literal> turns on VBA compatible Basic compiler mode at module level. Function <literal>CompatibilityMode()</literal> controls runtime mode and affects all code executed after setting or resetting the mode.</paragraph>
    </section>
    <embed href="text/sbasic/shared/00000003.xhp#beforeexecutable"/>
    <paragraph role="paragraph" id="N0107">This option may affect or assist in the following situations:</paragraph>
    <list type="unordered">
        <listitem><paragraph role="listitem" id="N0108">Allow special characters as identifiers.</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0109">Create constants including non-printable characters.</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0110">Support <literal>Private</literal>/<literal>Public</literal> keywords for procedures.</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0111">Compulsory <literal>Set</literal> statement for objects.</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0112">Default values for optional parameters in procedures.</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0113">Named arguments when multiple optional parameters exist.</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0114">Preload of %PRODUCTNAME Basic libraries</paragraph></listitem>
    </list>
    <note id="N0115"><literal>Option Compatible</literal> is required when coding class modules.</note>
    <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
    <paragraph role="code" localize="false" id="N0117">Option Compatible</paragraph>
    <section id="compatibilitymodefunction">
        <h1 id="N0118"><variable id="compatibilitymodestatement"><link href="text/sbasic/shared/compatible.xhp" name="CompatibilityMode">CompatibilityMode() Function</link></variable></h1>
        <paragraph role="paragraph" id="N0120"><literal>CompatibilityMode()</literal> function is controlling runtime mode and affects all code executed after setting or resetting the mode. <literal>Option Compatible</literal> turns on VBA compatibility at module level for the %PRODUCTNAME Basic compiler.</paragraph>
        </section>
    <warning id="N0119">Use this feature with caution, limit it to document conversion situations for example.</warning>
    <paragraph role="paragraph" id="N0121">This function may affect or help in the following situations:</paragraph>
    <list type="unordered">
        <listitem><paragraph role="listitem" id="N0122">Creating enumerations with Enum statement</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0123">Updating Dir execution conditions</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0124">Running RmDir command in VBA mode</paragraph></listitem>
        <listitem><paragraph role="listitem" id="N0125">Changing behaviour of Basic Dir command</paragraph></listitem>
    </list>
    <note id="N0126"><literal>CompatibilityMode()</literal> function may be necessary when resorting to <literal>Option Compatible</literal> or <literal>Option VBASupport</literal> compiler modes.</note>
    <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
    <paragraph role="code" localize="false" id="N0128">CompatibilityMode(True | False)</paragraph>

    <section id="relatedtopics">
        <paragraph role="paragraph" id="N0129">
            Refer to <link href="text/sbasic/python/python_platform.xhp">Identifying the Operating System</link> and <link href="text/sbasic/python/python_session.xhp">Getting Session Information</link> for <literal>Option Compatible</literal> simple examples, or <link href="text/sbasic/guide/access2base.xhp">Access2Base shared Basic library</link> for other class examples making use of <literal>Option Compatible</literal> compiler mode.
        </paragraph>
        <embed href="text/sbasic/shared/03090407.xhp#remstatement"/>

        <paragraph role="paragraph" id="N0131">
            Variables scope modification in <link href="text/sbasic/shared/01020300.xhp">Using Procedures and Functions</link> with <literal>CompatibilityMode()</literal> function.
        </paragraph>
        <embed href="text/sbasic/shared/03103200.xhp#optionbasestatement"/>
        <embed href="text/sbasic/shared/03103300.xhp#explicitstatement"/>
        <embed href="text/sbasic/shared/03103350.xhp#vbasupportstatement"/>
        <embed href="text/sbasic/shared/classmodule.xhp#classmodulestatement"/>
    </section>
</body>
</helpdocument>