How do I customize the context menu?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like to customize the context menu in excel (ie - to add and remove commands from the "right-click" menu), but I've been unable to find out how to do this. It does not seem possible to add or remove commands from the context menu via the "Tools -> Customize" menu as the context menu is not visible there. Any information anybody has on how to do this would be must appreciated. Thanks!
 
JJ,

The commandbar is actually called "Cell".

Here are two subs that show how to modify it. The first
will add a smiley-faced button that calls the subroutine named
JJMacro() from
the file MyFile.xls. To reset the Cell drop down menu, use the second
sub.

Bernie

Sub ChangeCellDropDown()
With Application.CommandBars("Cell")
..Reset
..Enabled = True
With .Controls.Add(Type:=msoControlButton, Before:=1)
..Caption = "JJ's Macro"
..Style = msoButtonIconAndCaption
..FaceId = 59
..OnAction = "MyFile.xls!JJMacro"
End With
End With
End Sub

Sub ResetCellDropDown()
Application.CommandBars("Cell").Reset
End Sub

HTH,
Bernie
MS Excel MVP

JJ said:
I'd like to customize the context menu in excel (ie - to add and
remove commands from the "right-click" menu), but I've been unable to
find out how to do this. It does not seem possible to add or remove
commands from the context menu via the "Tools -> Customize" menu as
the context menu is not visible there. Any information anybody has on
how to do this would be must appreciated. Thanks!
 
Back
Top