Good question! The following code solves your problem by removing the toolbar each time the workbook opens but I would love to know if there is a way to actually delete the attached toolbar forever.
The following solution assumes that your custom toolbar is called CustomToolbar. You need to find out the name of the toolbar that is attached before you can implement this solution.
- Open the workbook that contains the custom toolbar.
- Press ALT+F11 to switch to the Visual Basic Editor
- In the explorer bar to the left of the screen, locate the VBA project that corresponds to the workbook and double click on the ThisWorkbook code module.
- Choose Workbook from the object drop down at the top left of the code module.
- Enter the following code.
Dim aToolbar As CommandBar
On Error Resume Next
For Each aToolbar In Application.CommandBars
If aToolbar.Name = "CustomToolbar" Then
aToolbar.Delete
End If
Next
The final result should appear as shown below:
Private Sub Workbook_Open()
Dim aToolbar As CommandBar
On Error Resume Next
For Each aToolbar In Application.CommandBars
If aToolbar.Name = "CustomToolbar" Then
aToolbar.Delete
End If
Next
End Sub
Save the workbook as an xlsm - a macro enabled workbook. Each time you open the workbook Excel will delete the custom toolbar.
Bookmarks