Add Method (Microsoft Word)

In Microsoft Word, the Temporary argument of the Add method (CommandBarControls object) is always ignored. Therefore, when you add a control button to a menu bar on a command bar, it remains in the Normal.dot template regardless of whether you set the Temporary argument to True. To remove an unnecessary menu item from the Normal.dot template, you can use one of the following methods.

  1. Delete Normal.dot. This requires Word to recreate the Normal default template, which also removes any other changes that may have been made to the Normal template, such as toolbars. Because all Word documents rely on the Normal template, you will need to delete the template manually rather than programmatically.
  2. Reset command bars. You can create a procedure to reset all command bars or only a specified command bar. This example resets all command bars, including menu bars and toolbars.
    Sub ResetAllCommandBars()
        Dim mnu As CommandBar
    
        'Error handler skips over custom toolbars,
        'which can't be reset
        On Error Resume Next
    
        For Each mnu In Application.CommandBars
            mnu.Reset
        Next mnu
    End Sub
    This example resets the items on only the menu bar instead of all toolbars in Word.
    Sub ResetMenuBar()
        Dim mnu As CommandBar
        For Each mnu In Application.CommandBars
            If mnu.Name = "Menu Bar" Then
                mnu.Reset
            End If
        Next mnu
    End Sub