Instructie Option Explicit

Specificeert dat elke variabele in de programmacode expliciet moet worden gedeclareerd met de Dim-instructie.

note

De Option Explicit-instructie wordt tijdens runtime geëvalueerd.


Syntaxis:

Option Explicit

Parameters:

warning

Deze instructie moet worden ingevoegd vóór de uitvoerbare programmacode in een module.


Voorbeeld:


Option Explicit
Sub ExampleExplicit
Dim sVar As String
    sVar = "Las Vegas"
    For i% = 1 To 10 ' Dit resulteert in een run-time fout
        Rem
    Next i%
End Sub

Help ons, alstublieft!