CitectVBA Programming Reference > CitectVBA Function Reference > String Functions > Option Explicit

Option Explicit

Forces explicit declaration of all variables.

The optional Option Explicit statement if used, must be placed at the top of the CitectVBA file. This causes a check of variable declarations at compile time. Setting this option is a good way to catch misspelling of variables in your code.

Syntax

Option Explicit

Related Functions

Const | Dim

Example

Option Explicit    
' various statements go here
' a compile error will occur with the following line
strMyVar = "This string assignment won't work"
'because strMyVar is not explicitly declared

Published June 2018