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.
 
Back
Top