Compiler Options, Runtime Conditions

Compiler options specified at the module level affect LibreOffice Basic compiler checks and error messages. Basic syntax as well as Basic set of instructions can be different according to the options that are in use. The less Option, the easiest and tolerant LibreOffice Basic language is. The more Option, the richer and controlled Basic language gets.


Compiler options must be specified before the executable program code in a module.


Option Statement diagram

Option Base 语句

将数组的默认下边界定义为 0 或 1。

Option ClassModule 语句


Option Compatible 语句

Option Compatible extends LibreOffice Basic compiler and runtime, allowing supplemental language constructs to Basic.

CompatibilityMode() Function

CompatibilityMode() function controls or queries runtime mode. It affects all code executed after setting or resetting the runtime mode.

Option Explicit 语句

指定必须使用 Dim 语句明确声明程序代码中的每个变量。

Option Private Module

Specifies that the scope of the module is that of the Basic library it belongs to.

Option VBASupport 语句

指定LibreOffice Basic 将支持一些 VBA 语句、函数和对象。


Options specified at the module level also affect LibreOffice Basic runtime conditions. The behaviour of LibreOffice Basic instructions can differ.