View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Out of Scope Errors when exiting Excel

Pretty sure there's something specific to your particular code, normally
shouldn't be any problem even with those references, at least in the way I
imagine they exist.

As I mentioned before, impossible to say what's wrong without some idea of
the code.

Regards,
Peter T

"Steve McLeod" wrote in message
...
I click the File menu and then Exit. Excel starts shutting down. While
shutting down Excel VBA flags objects as missing and opens the debugger.
Sometimes the flagged code is a reference to a control on a sheet,
sometimes
it is a global variable, and sometimes it is a sheet reference, and
sometimes
Excel exits without starting the debugger. The "End" button is the one on
the debugger prompt that permits the user to enter debugging or just end
execution.

The only reason these errors can occur is that Excel has closed the
referenced object prior to scanning the code that references it. This is
stupid. Why worry about object references when all of them are being
closed?
Why try to execute a control event when the application is closing?

--
Pictou


"Steve McLeod" wrote:

I have worksheets with controls and associated event code. When I exit
the
Excel I am getting compiler errors in code that references controls and
other
objects that have gone out of scope while Excel is shutting down. The VBA
code that is flagged as in error is not consistently the same. How do I
get
Excel to shut down without the need to click the "End" button in the VBA
debugger prompt?
--
Pictou