Bewerken

Delen via


CommandBars.ActiveMenuBar property (Office)

Gets a CommandBar object that represents the active menu bar in the container application. Read-only.

Note

The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface. For more information, see Overview of the Office Fluent ribbon.

Syntax

expression.ActiveMenuBar

expression A variable that represents a CommandBars object.

Example

This example adds a temporary pop-up control named Custom to the end of the active menu bar, and adds a control named Import to the popup control.

Set myMenuBar = CommandBars.ActiveMenuBar 
Set newMenu = myMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True) 
newMenu.Caption = "Custom" 
Set ctrl1 = newMenu.CommandBar.Controls _ 
    .Add(Type:=msoControlButton, Id:=1) 
With ctrl1 
    .Caption = "Import" 
    .TooltipText = "Import" 
    .Style = msoButtonCaption 
End With

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.