Set subMenu = menutext.Controls.add(Type:=msoControlButton, ID:=3, before:=2)
With subMenu
.Caption = "MainMenu"
.Enabled = True
End With
Set subMenu = menutext.Controls.add(Type:=msoControlButton, ID:=3, before:=k + 1)
With subMenu
.Caption = "SubMenu"
.Enabled = True
End With
我想(可能吗?) - MainMenu - > SubMenu - > SubsubMenu。 直到我能够获得MainMenu - >子菜单。
答案 0 :(得分:0)
Set menutext = Application.CommandBars("Cell").Controls.Add(msoControlPopup)
With menutext
.Caption = "MainMenu"
.Enabled = True
End With
Set subMenu = menutext.Controls.Add(msoControlPopup)
With subMenu
.Caption = "SubMenu"
.Enabled = True
End With
Set subMenuSubMenu = subMenu.Controls.add(Type:=msoControlButton, ID:=3, before:=k + 1)
With subMenuSubMenu
.Caption = "SubMenuSubMenu"
.Enabled = True
End With