- 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
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