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!

Option explicit - is this my problem

Status
Not open for further replies.

NIWANut

Programmer
May 20, 2003
25
NZ
Hi,

I have been given an excel workbook to check the macro coding and each time I run any of the macros I get an error

"Compile Error
Can't find project or library"

on a line such as

"ThisRow=2"

if I declare the variable with a Dim statement the macro will proceed until the next variable is used.

I presumed this error occcurred because Option Explicit was used, so I checked the project for it but cannot find it anywhere, I also made sure under Tools | Options | Editor in VBA that the option Require Variable Declaration is unchecked. Even closed Excel and re-started after doing this and it continues to complain.

I am running Excel 2000 under Windows XP.

Any one got any ideas how to fix this?

Thanks


George
 
Not sure about XL/VBA but based on VB - The state of Require Variable Declaration at the time each module or form is created determines wether or not the Option Explicit statement is added to the module/form. Changing the Require Variable Declaration only effects new forms/modules. Existing ones must be changed indiviually by removing/adding the Option Explicit statement.


Hope this helps (and makes sense)
 
Thanks for that clarification, I didn't realise that Require Variable Declaration was important when each module was created.

But..., I have been unable to find Option Expilict in any modules in the workbook - that is my problem - there appears to be something else affecting it but for the life of me I cannot find it.

Thanks

George
 
Check the references:
menu Tools -> References ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top