Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When Option Explicit is ignored

Status
Not open for further replies.

stduc

Programmer
Nov 26, 2002
1,903
GB
Excel 2007

I use Option Explicit as a typo preventer amongs others. Recently and on occasion I mistype and the cariable is compiled. How come? Has anyone else experienced this bug? If that's what it is.
 

Is it possible by miss-typing you typed some other variable name that was declared?

BTW - I am too lazy to type so I do this:
Code:
Dim strMyVariableName As String
...
strmyv [green]'and here I hit Ctrl-Space for the editor 
       'to type the rest of the name for me[/green]
Is that lazy or what? :)

Have fun.

---- Andy
 


Lazy, fair?

It is not quite laissez faire, because it is quite hands on. ;-)

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
>>Is that lazy or what?

>Can't be; I do it too

It must be; because I do it too. ;)
 
Lazy? Hardly. It is using the functionality of the editor precisely as it was designed to be used.

 
This problem is usually caused by some type of non-printable characters preceding the option explicit or corruption in the project itself. Normally fixed by simply deleting Option Explicit and retyping it.

1) Delete option explict and other non variable declarations from the beginning of the module/modules.
2)Retype it back in
3)debug/compile
4)compact and repair

If this does not fix it, the concern is corruption in the project. I would rebuild from a clean project.
 
I found that I had one test module without Option Exlicit. When I added it the issue was resolved. Now that proves nothing as I effectively did your 1 to 3 Majp. LOL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top