Anweisung Option Explicit

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

note

The Option Explicit statement is evaluated at run time.


Syntax:

Option Explicit

Parameter:

warning

Diese Anweisung muss in einem Modul vor dem ausführbaren Programmcode eingefügt werden.


Beispiel:


Option Explicit
Sub ExampleExplicit
Dim sVar As String
    sVar = "Las Vegas"
    For i% = 1 To 10 ' Gibt einen Laufzeitfehler zurück
        Rem
    Next i%
End Sub