ActiveMenuBar Property

Applies To

CommandBars collection object.

Description

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

See Also

Add method (CommandBars collection).

Example

This example adds a temporary pop-up control named "Custom" to the end of the active menu bar, and then it adds a button control named "Import" to the command bar displayed by the 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