Sub MakeMenuBar()
Dim NewMenuBar As commandBar
Set NewMenuBar = CommandBars.Add(MenuBar:=True)
With NewMenuBar
.name = "MyMenuBar"
.Visible = True
End With
CommandBars("Worksheet Menu Bar") _
.Controls(1).Copy Bar:=CommandBars("MyMenuBar")
Set NewMenu = NewMenuBar.Controls.Add _
(Type:=msoControlPopup)
NewMenu.Caption = "&Commands"
Set NewItem = NewMenu.Controls.Add(Type:=msoControlButton)
With NewItem
.Caption = "&Restore Normal Menu"
.OnAction = "DeleteMenuBar"
End With
Set NewItem = NewMenu.Controls.Add(Type:=msoControlButton)
With NewItem
.Caption = "&Help"
.OnAction = "DeleteMenuBar"
End With
End Sub
Sub DeleteMenuBar()
On Error Resume Next
CommandBars("MyMenuBar").Delete
On Error GoTo 0
End Sub
|