![]() |
Add-in closes first when Excel is closed, causing problems
I have an add-in whose workbook_beforeclose event closes a toolbar that is
attached to the add-in. When a user closes Excel, it appears that the event is closed as one of the first, and the toolbar is deleted. However, if the user has made changes to other workbooks, he is asked whether he wants to save them and upon canceling this operation, Excel remains active as does the add-in. The toolbar is gone and cannot be made visible again as it has been deleted. The only way is to close and restart excel. When Excel is really closed after the aborted first time, an error occurs, because the workbook_beforeclose event now tries to delete an already deleted toolbar. Is there a way to solve this problem? Thanks in advance, |
Add-in closes first when Excel is closed, causing problems
Why delete the toolbar? The add-in will load again when you open Excel.
You can put an "On Error Resume Next" statement in front of the delete statement and "On Error Goto 0" right after. This will stop the error msg. Robert Flanagan http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Arne" wrote in message ... I have an add-in whose workbook_beforeclose event closes a toolbar that is attached to the add-in. When a user closes Excel, it appears that the event is closed as one of the first, and the toolbar is deleted. However, if the user has made changes to other workbooks, he is asked whether he wants to save them and upon canceling this operation, Excel remains active as does the add-in. The toolbar is gone and cannot be made visible again as it has been deleted. The only way is to close and restart excel. When Excel is really closed after the aborted first time, an error occurs, because the workbook_beforeclose event now tries to delete an already deleted toolbar. Is there a way to solve this problem? Thanks in advance, |
All times are GMT +1. The time now is 08:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com