Option Explicit Statement
指定必須使用 Dim 陳述式明確宣告程式碼中的每個變數。
語法:
Option Explicit
參數:
此陳述式必須位於模組中的可執行程式碼之前。
示例:
Option Explicit
Sub ExampleExplicit
Dim sVar As String
sVar = "Las Vegas"
For i% = 1 to 10 REM 這將導致執行階段錯誤
Rem
Next i%
End Sub