Option Explicit Statement

 

Option Explicit

 

Forces explicit declaration of all variables.

 

The Option explicit statement is used outside of the script in the declarations section.   This statement can be contained in a declare file or outside of any script in a file or buffer.   If  this statement is contained in the middle of a file the rest of the compile buffer will be affected.

 

 

Related Topics:  Const and Global Statements

 

Example :

 

Option Explicit 

Sub Main

   Print y    ‘because y is not explicitly dimmed an error will occur.

 

End Sub