Partager via


DocumentBase.CommandBars Property

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

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property CommandBars As CommandBars
public CommandBars CommandBars { get; }

Property Value

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

Remarks

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

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 Sub DocumentCommandBars()
    Me.CommandBars("Drawing").Visible = True 
    Me.CommandBars("Drawing").Position = Office.MsoBarPosition.msoBarBottom
End Sub
private void DocumentCommandBars()
{
    this.CommandBars["Drawing"].Visible = true;
    this.CommandBars["Drawing"].Position = Office.MsoBarPosition.msoBarBottom;
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace