Option Explicit Statement

Anger att alla variabler i programmet måste deklareras explicit med ett Dim-uttryck.

Syntax:

Option Explicit

Parametrar:

warning

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


Exempel:


Option Explicit
Sub ExampleExplicit
Dim sVar As String
    sVar = "Las Vegas"
    For i% = 1 To 10 ' Orsakar ett runtime-fel
        Rem
    Next i%
End Sub

Stötta oss!