Functie CompatibilityMode

CompatibilityMode() function is controlling runtime mode and affects all code executed after setting or resetting the mode.

warning

Wees voorzichtig met het gebruik van deze functionaliteit, beperk deze bijvoorbeeld tot de conversie van een document.


note

Option Compatible turns on VBA compatibility at module level for the LibreOffice Basic interpreter.


Deze functie heeft invloed op of kan nuttig zijn in de volgende situaties:

note

CompatibilityMode() function may be necessary when resorting to Option Compatible or Option VBASupport compiler modes.


Syntaxis:

CompatibilityMode(True | False)

Voorbeeld:

Given a NOT empty directory at file:///home/me/Test


        Sub RemoveDir
            CompatibilityMode( true )
            RmDir( "file:///home/me/Test" )
        End Sub
   

With CompatibilityMode( true ) the program results in an error, otherwise the Test directory and all its content is deleted.

Voorbeeld:

Gedrag Dir aanpassen


    Sub VBADirCommand
        CompatibilityMode( true )   ' Shows also normal files
        Entry$ = Dir( "file:///home/me/Tmp/*.*", 16 )
        Total$ = ""
        While Entry$ <> ""
            Total$ = Total$ + Entry$ + Chr$(13)
            Entry$ = Dir
        Wend
        MsgBox Total$
    End Sub
    

Refer to Identifying the Operating System and Getting Session Information for Option Compatible simple examples, or Access2Base shared Basic library for other class examples making use of Option Compatible compiler mode.

Het wijzigen van het bereik van variabelen in Procedures en Functions gebruiken met de functie CompatibilityMode.