Option Explicit Statement

  • Thread starter Thread starter hermie
  • Start date Start date
H

hermie

When I run the performance analyzer I get in idea tip to use an Option
Explicit Statement
1 What is an Option Explicit Statement
2 Where can I see / find this

Herman
 
Option Explicit is a statement that goes at the top of a module in the
Declarations section. It will cause the compiler to raise errors if your
code uses variables that are not defined in Dim or Const or Public or
Private statements. Helps you to avoid typos in variable names.

It's explained in Help file. You can have all new modules always include
this statement if you open Visual Basic Editor, click Tools | Options, and
select the "require variable declaration" checkbox.
 
Option Explicit is a VBA statement used at the module
level. It must appear before any procedures. Its
presence requires that all variables be declared and
typed. The man advantage of using it is that the compiler
can then find any variable-name typos in the body of your
code.

HTH
Kevin Sprinkel
 
Back
Top