If Toolbar Exists

Joined
Jul 25, 2007
Messages
26
Reaction score
0
Hello Everyone.

Can Someone help me withe the following code. I can't see why it won't work.
GeoffreyBarnard
Sub SaveAS()
''If the toolbar exists the code works.
''the code breaks at the next line if the toolbar does not exist.
''This is the main part of what I want to happen
If CommandBars(ActiveWorkbook.Name) Is Nothing Then
Exit Sub
Else
Application.Run "Delete_Toolbar"
Application.Dialogs(xlDialogSaveAs).Show
Application.Run "Delete_Toolbar"
End If
End Sub
Sub Delete_Toolbar()
''This macro deletes toolbar, it is called by Workbook_BeforeClose on ThisWorkbook Sheet
Application.CommandBars(ActiveWorkbook.Name).Delete
End Sub
 

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