セルの右クリックメニューに独自のアクションを追加したり、元に戻したり。

 

    Dim ac: Set ac = Application.CommandBars("Cell")

    With ac
        'メニュー追加
        With .Controls.Add(before:=1)
            .Caption = "表示するメニュー名"
            .OnAction = "呼び出すマクロ名"
            .BeginGroup = False
        End With
        
        'メニュー削除
        .Controls("メニュー名").Delete
        
        'リセット
        .Reset
    End With

 

時折めっちゃ頼ります。

 

 

シートタブの右クリックメニューの場合は

Set ac = Application.CommandBars("Ply")

です

AD