customize context menu

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

I know how easy it is to customize toolbars and menu bars but that seems
to exclude the "right click" context menu. How can I do that?
I want to add a summation command and a data sort command, I use them a lot.
 
Andy

Done through VBA code. In the ThisWorkbook module.

Private Sub WorkBook_Open()
With Application.CommandBars("Cell").Controls.Add(temporary:=True)
.Caption = "Change Text Case"
.OnAction = "MyMacros.xla" & "!Chg_Case"
End With
End Sub

To clear the menu when you close. Otherwise you get duplicates.

Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Cell").Controls("Change Text Case").Delete
End Sub

Place this code in your Personal.xls or in my case, the MyMacros add-in.

Gord Dibben Excel MVP
 
Hi Andy,
You specifically asked for AutoSum -- don't know what the fascination is
about AutoSum on right click menus is but see this previous posting:
http://google.com/[email protected]

I won't touch the sort part of your question, as I can't think of anything that
would be generic work in a wide range of situations and not mess up
data if used accidentally. At least not without particulars on exactly
what you want and why a right-click menu. Some help on using sort
http://www.mvps.org/dmcritchie/excel/sorting.htm#ctrla
 
Back
Top