Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Workbook_BeforeClose change event not running correctly

I have customised my Worksheet menu so that the "File" command is disabled
completely. To close, I have added a custom menu running a simple macro
called "CloseMe", containing the command "activeworkbook.close"
However, when I close in this way, my Workbook_BeforeClose (which restores
the Worksheet Menu Bar and Toolbars) doesn't run.
If re-enable the standard File Close command, and close this way it runs OK.
Is there any way in which I can force my BeforeClose macro to run when the
workbook is closed down via the first method, without having to add all the
BeforeClose commands to the "CloseMe" macro?

Thanks in advance & have a good weekend

Pete
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Workbook_BeforeClose change event not running correctly

have you tried:

application.screenupdating=false
workbook_beforeclose
activeworkbook.close
application.screenupdating=true

"Peter Rooney" wrote:

I have customised my Worksheet menu so that the "File" command is disabled
completely. To close, I have added a custom menu running a simple macro
called "CloseMe", containing the command "activeworkbook.close"
However, when I close in this way, my Workbook_BeforeClose (which restores
the Worksheet Menu Bar and Toolbars) doesn't run.
If re-enable the standard File Close command, and close this way it runs OK.
Is there any way in which I can force my BeforeClose macro to run when the
workbook is closed down via the first method, without having to add all the
BeforeClose commands to the "CloseMe" macro?

Thanks in advance & have a good weekend

Pete

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Workbook_BeforeClose change event not running correctly

No, Excel didn't seem to like that,
It gave me "Sub or Function not defined"

Thanks anyway

Pete



"Vacation's Over" wrote:

have you tried:

application.screenupdating=false
workbook_beforeclose
activeworkbook.close
application.screenupdating=true

"Peter Rooney" wrote:

I have customised my Worksheet menu so that the "File" command is disabled
completely. To close, I have added a custom menu running a simple macro
called "CloseMe", containing the command "activeworkbook.close"
However, when I close in this way, my Workbook_BeforeClose (which restores
the Worksheet Menu Bar and Toolbars) doesn't run.
If re-enable the standard File Close command, and close this way it runs OK.
Is there any way in which I can force my BeforeClose macro to run when the
workbook is closed down via the first method, without having to add all the
BeforeClose commands to the "CloseMe" macro?

Thanks in advance & have a good weekend

Pete

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Workbook_BeforeClose change event not running correctly

There is no reason it shouldn't run unless you have disabled events.

--
Regards,
Tom Ogilvy

"Peter Rooney" wrote in message
...
I have customised my Worksheet menu so that the "File" command is disabled
completely. To close, I have added a custom menu running a simple macro
called "CloseMe", containing the command "activeworkbook.close"
However, when I close in this way, my Workbook_BeforeClose (which restores
the Worksheet Menu Bar and Toolbars) doesn't run.
If re-enable the standard File Close command, and close this way it runs

OK.
Is there any way in which I can force my BeforeClose macro to run when the
workbook is closed down via the first method, without having to add all

the
BeforeClose commands to the "CloseMe" macro?

Thanks in advance & have a good weekend

Pete



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Workbook_BeforeClose change event not running correctly

Tom,

I'll take a look at what I've disabled & get back to you on Monday - it's
home time - yippee!

Have a good weekend

Pete



"Tom Ogilvy" wrote:

There is no reason it shouldn't run unless you have disabled events.

--
Regards,
Tom Ogilvy

"Peter Rooney" wrote in message
...
I have customised my Worksheet menu so that the "File" command is disabled
completely. To close, I have added a custom menu running a simple macro
called "CloseMe", containing the command "activeworkbook.close"
However, when I close in this way, my Workbook_BeforeClose (which restores
the Worksheet Menu Bar and Toolbars) doesn't run.
If re-enable the standard File Close command, and close this way it runs

OK.
Is there any way in which I can force my BeforeClose macro to run when the
workbook is closed down via the first method, without having to add all

the
BeforeClose commands to the "CloseMe" macro?

Thanks in advance & have a good weekend

Pete






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
Data don't enter correctly in Excel 2002 running under Vista Conrad Excel Discussion (Misc queries) 3 December 11th 07 05:52 AM
Workbook_BeforeClose event is not canceled Mircea Pleteriu[_2_] Excel Programming 1 June 8th 05 08:47 AM
Detecting a cancel on Workbook_BeforeClose event? Don Wiss Excel Programming 3 January 18th 05 12:49 PM
Workbook_Beforeclose vs BeforeClose Event Juan Pablo González Excel Programming 3 February 2nd 04 12:17 AM
Workbook_BeforeClose Event Shatin Excel Programming 2 January 24th 04 03:50 AM


All times are GMT +1. The time now is 07:11 AM.

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

About Us

"It's about Microsoft Excel"