Refining my customised menu

nigelandrewfoster

Well-known Member
Joined
May 27, 2009
Messages
747
Hi, just a quickie. Have customised the rightclick 'cell' menu so when I rightclick on a cell, the menu is displayed and I run a macro. The new menu item is displayed at the BOTTOM of the menu (after the preset commands). Is there a way of a) Deleting some of the preset commands above my new item that I don't use? b) Can I otherwisse move my new command further up the pecking order? Thanks. NIGEL
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
To remove cell right-click menu options, for example Cut, Copy and Paste:

Code:
    CommandBars("Cell").Controls("Cut").Delete
    CommandBars("Cell").Controls("Copy").Delete
    CommandBars("Cell").Controls("Paste").Delete

To add your custom menu option as the first item:
Code:
    With CommandBars("Cell").Controls.Add(msoControlPopup, Before:=1)
        .Caption = "My Menu Option"
    End With
 
Upvote 0
Thanks for your help, John. It never ceases to amaze me just how customizable Excel is! Final question, I will need to RESTORE these fixed deleted options when the workbook closes, what command should I use? I know about events, but I can't specify a macro name for 'CUT' for example, because it is a built in command and not a macro. Nigel.
 
Upvote 0
The easiest way is to reset the Cell right-click menu, which deletes the customised options and restores the default options:
Code:
Application.CommandBars("Cell").Reset
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top