Toolbars and Crashing

M

Mick

I have an application I have written in which the first
step is to determine if a toolbar exists. If it does,
the macro makes it visible. If it doesn't, the macro
creates it and makes it visible. When the application
closes, it hides the toolbar. This all works well except
of the user quits the application without saving, Excel
crashes - every time. I have disabled the toolbar
portion of the application and the crashing goes away, so
I know it's in that area, but I don't understand why it
is causing the crashing.

Any ideas?
 
R

Ron de Bruin

Hi Mick

I always create a toolbar when the file opens and delete it when I close it
In your workbook open event use this lines first to be sure that the toolbar is delete.
If Excel crash it is possible that your close event will not run that delete the toolbar

On Error Resume Next
Application.CommandBars("MyMenuBar").Delete
On Error GoTo 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top