Option Explicit

  • Thread starter Thread starter Piranha
  • Start date Start date
P

Piranha

Hi,

Would someone please explain to me the "Option Explicit" phrase.

What does it do?
When should you use it?
Etc

Thx
Dave
 
It forces you to declare every variable you use in that module.

You should use it in every module that you have.

When this doesn't work like it should
myCtr1 = myCtrl + 1
(one of those has an ELL and one has a ONE)
It really makes debugging easier.
 
First, you should ALWAYS use it.

What it does it is to force you to explicitly declare your variables. If
you fail to declare them, then you will get a compilation error.

The advantage of using it is that you won't then make the mistake of
mis-spelling (even slightly) variable names deep in the code, as the
compiler will flag it.

You can use the VB IDE to help you by automatically installing this line in
your modules. To do this, in the VB IDE, go to Tools>Options>Editor, and
check the 'Require Variable Declaration' checkbox.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Hi,
I don't know how to quote the entire thread so i picked on Anne.

Anne-yes fish :) (at work i am (first -Ima, last Fish,--"Ima Fish")
Dave
Bob
Chip

You guys are wonderfull. Thx for the great info and links.
Now i am trying to soak it up into my brain.

Thx Very Much for your responces
Dave
 
Back
Top