ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using BeforeClose for deleting a custom toolbar (https://www.excelbanter.com/excel-programming/289911-re-using-beforeclose-deleting-custom-toolbar.html)

daithimcc[_5_]

Using BeforeClose for deleting a custom toolbar
 
Thanks for the posts. Using the method you suggest, the toolbar is
deleted even if the user chooses Cancel when prompted to Save. The
workbook must only delete the toolbar if Cancel has not been pressed in
the Save dialog.
(This is why I was trying to use a variable itsclsing).
Any further suggestions would be appreciated.
Thanks, David


---
Message posted from http://www.ExcelForum.com/


Bob Phillips[_6_]

Using BeforeClose for deleting a custom toolbar
 
But your code was in the BeforeClose event, not BeforeSave.Why would you not
want the toolbar deleted when closing the workbook just because the user
chose not to save it?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"daithimcc " wrote in message
...
Thanks for the posts. Using the method you suggest, the toolbar is
deleted even if the user chooses Cancel when prompted to Save. The
workbook must only delete the toolbar if Cancel has not been pressed in
the Save dialog.
(This is why I was trying to use a variable itsclsing).
Any further suggestions would be appreciated.
Thanks, David


---
Message posted from http://www.ExcelForum.com/




John McGimpsey

Using BeforeClose for deleting a custom toolbar
 
If the user attempts to close the workbook without having saved changes,
the Before_Close code executes, then s/he is prompted to save. If the
user chooses cancel, then the workbook is left open, but the toolbar is
already deleted.

I've seen a number of workarounds, but AFAIK, there's no bulletproof way
to deal with this on a Workbook level. The Before_Close event is the
first event fired. The Save dialog fires after the Before_Close macro
has executed.


In article ,
"Bob Phillips" wrote:

But your code was in the BeforeClose event, not BeforeSave.Why would you not
want the toolbar deleted when closing the workbook just because the user
chose not to save it?


daithimcc[_6_]

Using BeforeClose for deleting a custom toolbar
 
When you choose close (beforeclose fires+you delete your toolbar), you
are asked if you want to save. When you choose Cancel, not only does it
not save but it also cancels the close. So, the workbook stays open,
but because beforeclose has already fired, you have already deleted the
toolbar (not the desired behaviour).


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 06:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com