Public Sub CreateMenu()
Dim myType As Variant
' 项目类别
' myType = MsoControlType.msoControlButton '按钮
' myType = MsoControlType.msoControlEdit '文本框
' myType = MsoControlType.msoControlDropdown '下拉列表
' myType = MsoControlType.msoControlComboBox '组合框
myType = MsoControlType.msoControlPopup '弹出框
Dim myMenuBar As CommandBar
Set myMenuBar = CommandBars.ActiveMenuBar
Dim newMenu As CommandBarPopup
Set newMenu = myMenuBar.Controls.Add(Type:=myType, Temporary:=True)
newMenu.Caption = "新菜单"・
Dim myControl As CommandBarButton
Set myControl = newMenu.CommandBar.Controls.Add(Type:=msoControlButton)
myControl.Caption = "新操作"
End Sub