Restoring a Built-in Toolbar

If one of the default toolbars has been modified — either by a user or by a Visual Basic procedure — you can return the toolbar to its default state by using the Reset method. Using this method corresponds to clicking the Toolbars command on the View menu, selecting the check box next to the name of the customized built-in toolbar in the Toolbars dialog box, and then clicking Reset.

For example, you can use the following code to reset all the toolbars to their default state and simultaneously delete all the custom toolbars.


For Each thisToolbar In Toolbars
    If thisToolbar.BuiltIn Then
        thisToolbar.Reset
    Else
        thisToolbar.Delete
    End If
Next

Caution

Be careful when you use the Reset method; it not only restores any built-in toolbar buttons that have been deleted, but it also deletes any custom toolbar buttons that have been added. Keep in mind that another macro may have added custom toolbar buttons to the toolbar, and resetting the toolbar will remove these buttons as well. To avoid these problems, remove any toolbar buttons added by your application one by one, without resetting the entire toolbar.