This article was previously published under Q207157
Moderate: Requires basic macro, coding, and interoperability skills.
Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.
View products that this article applies to.
CommandBars("MenuBar2").Visible = True
CommandBars("MenuBar1").Visible = True
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
Keywords: KB207157, kbprb, kbui