Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exiting Excel MEAD5432 Excel Discussion (Misc queries) 2 December 7th 07 11:05 PM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Troubleshoot when exiting Excel. Leirbag Excel Discussion (Misc queries) 1 December 7th 04 12:49 PM
Exiting Excel without being prompted John Flynn Excel Programming 0 August 23rd 03 02:35 AM
Exiting Excel without being prompted JohnFlynn Excel Programming 0 August 23rd 03 01:49 AM


All times are GMT +1. The time now is 04:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"