Option Explicit Statement

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

Parameters:

warning

សេចក្តី​ថ្លែង​ការណ៍​នេះ​ត្រូវ​តែ​បាន​​បន្ថែម​ពី​មុខ​​កូដ​កម្មវិធី​ដែល​អាច​ប្រតិបត្តិ ដែល​ស្ថិត​ក្នុង​ម៉ូឌុល​មួយ ។


Example:


Option Explicit
Sub ExampleExplicit
Dim sVar As String
    sVar = "Las Vegas"
    For i% = 1 to 10  REM This results in a run-time error
        Rem
    Next i%
End Sub