- "Option Explicit" is a keyword used to declare variables explicitly.When you use the Option Explicit statement, you must explicitly declare all variables using the Dim, Private, Public, or ReDim statements. If you attempt to use an undeclared variable name, an error occurs.
- Use Option Explicit to avoid incorrectly typing the name of an existing variable or to avoid confusion in code where the scope of the variable is not clear.
Example:
Option Explicit
Dim input, input1
Input=10
input1=20
Error: Variable is undefined: input1
No comments:
Post a Comment