LibreOffice SymbolLibreOffice Symbol

请支持我们!

Option Explicit 语句

Specifies that every variable in the program code must be explicitly declared with the Dim statement.

批注图标

The Option Explicit statement is evaluated at run time.


语法:

Option Explicit

参数:

警告图标

此语句必须添加到模块中的可执行程序代码之前。


示例:


Option Explicit
Sub ExampleExplicit
Dim sVar As String
    sVar = "Las Vegas"
    For i% = 1 To 10 ' 将导致运行时错误
        Rem
    Next i%
End Sub