Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Out of Scope Errors when exiting Excel
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Out of Scope Errors when exiting Excel
You shouldn't have to use the End button (except in development) or the End
statement ever. Impossible to say much more without the code, but in general ensure all object references that will not go out of scope automatically (most do) are released. Regards, Peter T "Steve McLeod" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Out of Scope Errors when exiting Excel
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Exiting Excel | Excel Discussion (Misc queries) | |||
Excel Throwing Circular Errors When No Errors Exist | Excel Worksheet Functions | |||
Troubleshoot when exiting Excel. | Excel Discussion (Misc queries) | |||
Exiting Excel without being prompted | Excel Programming | |||
Exiting Excel without being prompted | Excel Programming |