This statement is used to allow or restrict the use of variable without its declaration. By default Option Explicit is On.
· Option Explicit Off
· Option Explicit On
Option Explicit On
By setting the Option Explicit to be On, it will restrict the use of a variable without its declaration. It will generate an error when user tries to use a variable without its declaration.
Example
newVar = 10
MsgBox(newVar)
In this case the complier will generate an error that newVar is not declared because Option Explicit is set to On.
Option Explicit Off
By setting the Option Explicit to be Off, it will allow the use of a variable without its declaration.
Example
newVar = 10
MsgBox (newVar)
In this case the compiler will not generate an error because Option Explicit is set to Off.
0 comments:
Post a Comment