Option Explicit Statement

Specifica che tutte le variabili usate nel codice del programma devono essere dichiarate esplicitamente con l'istruzione Dim.

Sintassi:

Option Explicit

Parametri:

warning

This statement must be added before the executable program code in a module.


Esempio:


Option Explicit
Sub ExampleExplicit
Dim sVar As String
    sVar = "Las Vegas"
    For i% = 1 to 10 ' Questa riga restituisce un errore runtime
        Rem
    Next i%
End Sub