Article ID: 167663
Article Last Modified on 1/19/2007
CommandBars("MenuBar2").Visible = True
If MenuBar2 is displayed on your screen, the following line of code
automatically sets the Visible property of MenuBar2 to False:
CommandBars("MenuBar1").Visible = True
In order to display more than one menu bar at a time, you must create your
new menu bar or view an existing one through the user interface as follows:
Public strCurrentMenuName As String
'*******************************************************************
' This procedure creates a new menu bar and makes it visible.
'*******************************************************************
Sub CreateMenuBar(strNewMenuName as String)
Dim cmdNewMenu As CommandBar
' Set Global strCurrentMenuName to existing menu for use later when
' toggling.
strCurrentMenuName = CommandBars.ActiveMenuBar.Name
' Create a new menu bar.
Set cmdNewMenu = Application.CommandBars.Add(strNewMenuName, _
msoBarFloating, True, False)
With cmdNewMenu
' Set Protection property to no protection so users can customize
' it.
.Protection = msoBarNoProtection
' Show new menu.
.Visible = True
End With
End Sub
CreateMenuBar "ExampleMenu"
CommandBars(strCurrentMenuName).Visible = True
159692 ACC97: How to Create Command Bars Using Visual Basic Code
172300 ACC97: Command Bar Wizard Available in Download Center
Additional query words: Cmdbar menubar commandbar display show hide invisible disappear appear
Keywords: kbprb kbprogramming kbui KB167663