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!

Fatal Exception Problems With VBA332.dll 2

Status
Not open for further replies.

OzzieOwl

Technical User
Dec 13, 2001
45
GB
I have several pieces of vba code in excel sheets, bur all of a suuden I have started to get Fatal Exceptions Caused in VBA332.dll
This is getting very frustrating as it happens at different stages of the macro everytime. If I run through with STEP INTO it runs fine, but if I run the macro it crashes with a fatal exception error, and closes the worksheet. Any help gratefully accepted.
 
This kind of behaviour may happen when spreadsheets needs to be activated in order for the code to run properly. In some cases debugging step by step does select or activate needed sheets, while running everything at once tries to access protected place in memory and so on because the proper sheet isn't activated. (By the way, that is one reason why a code should never -or nearly so- rely on a sheet being selected or activated.)

When this happen to me, I put breakpoint in my code to try to locate the exact place it fails. Put a breakpoint in the middle of your code. Run the code (not in debug mode). If you get your failure error, put a breakpoint earlier on; if you don't get the failure error, remove your previous breakpoint and put a new one later on. And so on, until you find out the exact line that makes it fail.

This is strenuous but might give you an idea of the nature of the error. Once you have located the line, the first thing I'd check is whether you use something like "cells" or "range" without precision about the workbook or the sheet it refers too. Alternatively, if you are in the middle of a "With workbook ...", check that you have ".cells" or ".range" everywhere and not just "cells" and "range".

Hope this helps,

Nath
 
Cheers Nath

Will try that out. Thanks for your help.
 
I used to have this problem, too, probably caused by a variety of issues as I was learning to code. But one thing I was doing was leaving object variables in place without making them Nothing. So when I'd be debugging and rechecking, I'd have the same object variable being called again. Don't know what that had to do with anything, other than being poor practice, but when I stopped doing it, I stopped getting the vba332.dll error. (Now watch me get one!) Kaulana (aka Bob)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top