Option Explicit and For Each... Construct

  • Thread starter Thread starter Richard Winston
  • Start date Start date
R

Richard Winston

When you use Option Explicit, must you always make a forward declaration
of the Element that you define in your For Each... statement ? I've
been getting errors, something about variable not declared. When I
Dim'd the Element as an Object prior to the For Each...statement, the
message went away.


Thanks.
 
Thats right - when you use Option Explicite you must also dclare your
variables.
Doing so - certainly gives you much better control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top