April 2006
Beginner
1114 pages
98h 16m
English
Before you create a custom toolbar, you should delete it. No, I’m not crazy: calling the CommandBars Add method fails if a toolbar with the same name already exists. The easiest way to make sure that name has not already been used is to delete it and ignore any errors as shown here:
Sub DeleteCodeToolbar( )
' Delete the toolbar if it already exists.
On Error Resume Next
Application.CommandBars("CodeToolbar").Delete
On Error GoTo 0
End SubThis technique assumes you’ve used a fairly unique name for your toolbar. A common name like Toolbar1 might result in deleting one of the user’s custom toolbars.
Read now
Unlock full access