|
メニューバーで検索してみたら、意外とメニューバーのマクロってないというか、残ってなかったので、谷さんと違う書き方です。
(普段は谷さんと同じようにsetした書き方をしてますけど....。)
Sub dnmm()
With Application.CommandBars("Worksheet Menu Bar").Controls
With .Add(Type:=msoControlPopup, Temporary:=True)
.Caption = "新メニュー"
With .Controls
With .Add(Type:=msoControlButton)
.Caption = "マクロ1"
.OnAction = "Mcro1"
End With
With .Add 'type略
.Caption = "マクロ2"
.OnAction = "Mcro2"
End With
With .Add(Type:=msoControlPopup)
.BeginGroup = True
.Caption = "マクロ3"
With .Controls.Add
.Caption = "マクロ3-1"
.OnAction = "Mcro3"
End With
End With
With .Add(Type:=msoControlPopup)
.Caption = "マクロ4"
With .Controls
With .Add
.Caption = "マクロ4-1"
.OnAction = "Mcro4-1"
End With
With .Add
.Caption = "マクロ4-2"
.OnAction = "Mcro4-2"
End With
End With
End With
End With
End With
End With
End Sub
|
|