Collapse the table of content
Expand the table of content
Expand Minimize

Document.CommandBars Property (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.

expression .CommandBars

expression Required. A variable that represents a Document object.

Use the CustomizationContext property to set the template or document context prior to accessing the CommandBars collection.

For information about returning a single member of a collection, see Returning an Object from a Collection .

This example enlarges all command bar buttons and enables ToolTips.

With CommandBars 
 .LargeButtons = True 
 .DisplayTooltips = True 
End With

This example displays the Drawing toolbar at the bottom of the application window.

With CommandBars("Drawing") 
 .Visible = True 
 .Position = msoBarBottom 
End With

This example adds the Versions command button to the Standard toolbar.

CustomizationContext = NormalTemplate 
CommandBars("Standard").Controls.Add Type:=msoControlButton, _ 
 ID:=2522, Before:=4
Show:
© 2016 Microsoft