Partager via


DocumentBase.CommandBars Property

Definition

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

public:
 property Microsoft::Office::Core::CommandBars ^ CommandBars { Microsoft::Office::Core::CommandBars ^ get(); };
public Microsoft.Office.Core.CommandBars CommandBars { get; }
member this.CommandBars : Microsoft.Office.Core.CommandBars
Public ReadOnly Property CommandBars As CommandBars

Property Value

A CommandBars collection that represents the menu bar and all the toolbars in Microsoft Office Word.

Examples

The following code example makes the Drawing toolbar visible at the bottom of the application. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentCommandBars()
{
    this.CommandBars["Drawing"].Visible = true;
    this.CommandBars["Drawing"].Position = Office.MsoBarPosition.msoBarBottom;
}
Private Sub DocumentCommandBars()
    Me.CommandBars("Drawing").Visible = True
    Me.CommandBars("Drawing").Position = Office.MsoBarPosition.msoBarBottom
End Sub

Remarks

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

Applies to