PDA

View Full Version : [SOLVED:] Excel crashes



hiflier
09-05-2010, 12:49 PM
I have a program that does sales, inventory and P&L processing for a very small company. It crashes regularly (screen goes white, round blue circle rotates constantly, need to go CTRL-ALT-DEL to get out of it).

It's Excel 2007 on Win 7 with a capable Toshiba Satellite. I use the .activate to load comboboxes and .deactivate to process changes to a sheet. It looks at .selectionchange to see the active cell name and handle input accordingly. I have a calendar that pops up when in a date cell and a calculator that pops up when in a numeric field.

The only thing I can figure is that Excel doesn't like all the background processing going on. This crash is so pervasive that I'm concerned about using Excel for this at all. What's wrong here? I can't really post all of the code, but I'm looking for a general answer about what in your experience causes Excel to crash like this. Things to avoid. Thanks for your help.
Dave

Jan Karel Pieterse
09-05-2010, 11:29 PM
Are you sure there is no event looping at play here?
Also, clean out the temp folder, maybe one of the temporary files that come with the use of ActiveX controls has gone awry.

p45cal
09-06-2010, 02:03 AM
If it is an event loop, is it stoppable with Ctrl+Break perhaps?

hiflier
09-06-2010, 10:36 AM
I think you are probably correct in looking at event looping. I've replaced all of the selectionchange events with buttons, so for instance the calculator only comes up if selected by the push of a button. I'll give it a while and see if it fails, then add back in the things I really want to automate. So far it hasn't failed. Thanks for both the replies to this thread. If I find a specific item that caused the looping I'll post another reply. Thanks again.

Paul_Hossler
09-06-2010, 10:39 AM
Shot in the dark ....

Inside your event handler(s), do you use



Sub ..._Change
Application.EnableEvents = False
..... your code
Application.EnableEvents = True
Exit Sub

so that your handler does not keep calling itself until it runs out of resources?

Paul

Jan Karel Pieterse
09-06-2010, 11:04 AM
You may want to have a look at this page:

http://www.jkp-ads.com/Articles/NoEvents00.asp