Sub AddNewMenu()
Dim HelpMenu As CommandBarControl
Dim NewMenu As CommandBarPopup
With ("Worksheet menu bar")
.Reset
Set HelpMenu = .FindControl(ID:=.Controls("帮助(&H)").ID)
If HelpMenu Is Nothing Then
Set NewMenu = .Controls.Add(Type:=msoControlPopup)
Else
Set NewMenu = .Controls.Add(Type:=msoControlPopup, _
Before:=HelpMenu.Index)
End If
With NewMenu
.Caption = "统计(&S)"
With .Controls.Add(Type:=msoControlButton)
.Caption = "输入数据(&D)"
.FaceId = 162
.OnAction = ""
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "汇总数据(&T)"
.FaceId = 590
.OnAction = ""
End With
End With
End With
Set HelpMenu = Nothing
Set NewMenu = Nothing
End Sub
Sub DelNewMenu()
("Worksheet menu bar").Reset
End Sub