View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Peter Peter is offline
external usenet poster
 
Posts: 349
Default Excel 2002 has encountered a problem and needs to close /Code Clea

I have an Excel 2002 workbook that intermittently gets the above error
message ("Excel 2002 has encountered a problem and needs to close") and
corrupts.

The workbook contains class modules, standard modules and userforms. Most
frequently the error message occurs when opening the workbook and clicking a
button on the userform that opens on entry (this button simply says €śexit€ť
and unloads the form). This isnt always the cause and sometimes may trigger
when updating links, or clicking on another button outside if the userform.
The spreadsheet is not shared, and is used my many users across a network (ie
only one person can have write access at any one time).

If I run Rob Boveys Code Cleaner against this workbook (once it has been
corrupted) on entering (before clicking any buttons) then it resolves the
problem. However a few days/weeks/months later the problem may re-occur
despite the fact that no new vba code has been added or edited. I was under
the impression that the code cleaner only cleans stuff from vba memory that
accumulates when new code is added? If this is true then how does it resolve
my problem if nothing has since accumulated (because I have added no new
code)?!

Is there some way for me to identify what the root cause for the problem is?
Does stuff accumulate in memory if perhaps I have not set variables to
nothing at the end of procedures for example?

Is there a way for me to run this code cleaner against a spreadsheet
automatically every time the spreadsheet is opened? The spreadsheet is very
critical and doesnt inspire user confidence if it crashes - this is the only
way I can think of to make sure the spreadsheet doesnt crash?!

HELP!