Ajuda del LibreOffice 7.2
CompatibilityMode() function is controlling runtime mode and affects all code executed after setting or resetting the mode.
Use this feature with caution, limit it to document conversion for example.
Opció compatible activa la compatibilitat amb VBA a nivell de mòdul per a l'intèrpret del Basic del LibreOffice.
This function may affect or help in the following situations:
Creating enumerations with Enum statement
Running RmDir command in VBA mode. In VBA only empty directories are removed by RmDir while LibreOffice Basic removes a directory recursively.
Changing behavior of Basic Dir command. The directory flag (16) for the Dir command means that only directories are returned in LibreOffice Basic, while in VBA normal files and directories are returned.
CompatibilityMode() function may be necessary when resorting to Option Compatible or Option VBASupport compiler modes.
CompatibilityMode(True | False)
Given a NOT empty directory at file:///home/me/Test
Sub RemoveDir
CompatibilityMode( true )
RmDir( "file:///home/me/Test" )
End Sub
Amb CompatibilityMode( true) el programa resulta en un error en cas contrari se suprimirà el directori de proves i tot el seu contingut.
Modificació del comportament de Dir
Sub VBADirCommand
CompatibilityMode( true ) ' Mostra també els fitxers normals
Entry$ = Dir( "file:///home/me/Tmp/*.*", 16 )
Total$ = ""
While Entry$ <> ""
Total$ = Total$ + Entry$ + Chr$(13)
Entry$ = Dir
Wend
MsgBox Total$
End Sub