Instructie Option Explicit

Definieert dat elke variabele die gebruikt wordt in de programmacode, expliciet moet worden gedeclareerd met de Dim-instructie.

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!