LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default ThisWorkBook BeforeClose Event

Carlos,

I like to put my call to the toolbar delete macro in the WorkbookDeactivate
module instead of the BeforeClose. In addition to solving your problem, it
also means that the toolbar goes away when you select/open a different
workbook. If you do this, you'll also need to call your toolbar create
macro in the WorkbookActivate event as well as the Open event, so that the
toolbar is created when you switch back to your workbook from the other one.

hth,

Doug Glancy

"Carlos Lozano" wrote in message
...
Hi,

My application creates a toolbar on Opening (this works fine) and I am

trying to delete it when the workbook is closed. I am calling the Toolbar's
delete method on the BeforeClose event of the ThisWorkBook Object.

The current behavior is below:
1) If the document was not modified, it works perfectly
2) If the document was modified, it prompts to save changes and if "yes"

or "No" are selected works fine. The BeforeClose event is executed as
expected.
2) If the document was modified, and "cancel" is selected the BeforeClose

event is executed. I wasn't expecting this as the workbook was not closed.
So, It deletes the toolbar and the workbook remains open (with no toolbar
which is a problem). The beforeClose event is executed before the message is
shown.

How can I know what was selected on the "Do you want to save..." message?

to choose the right action.

Thank you,

Carlos Lozano
CAX IT Services




 
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
ThisWorkBook BeforeClose Event David Adamson[_4_] Excel Programming 0 July 29th 04 12:32 AM
How to keep spreadsheet open in the BeforeClose event Wellie[_2_] Excel Programming 3 February 29th 04 09:03 PM
Workbook_Beforeclose vs BeforeClose Event Juan Pablo González Excel Programming 3 February 2nd 04 12:17 AM
Cancelling the BeforeClose Event Troy[_5_] Excel Programming 6 December 2nd 03 06:40 AM
BeforeClose event - Savings Mike[_40_] Excel Programming 3 September 24th 03 11:33 AM


All times are GMT +1. The time now is 01:11 PM.

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"