I'm trying to deactivate some of the options on the right click of the mouse button in Excel.
A lot of them work but "New Comment", "New Note" and "Format Cells..." don't with the format: Application.CommandBars("cell").Controls("New Comment").Enabled = False.
I'm looking for the syntax to get these commands but also is there a way to do the same thing using the control ID (which for "New Comment" is, I think, ID01589. Finding the ID for a lot of these right click options seems to be easier then using the label.
In addition to finding the syntax for the above three items on the right click menu I would like to know how to do it for items in other menus i.e. teach me how to fish rather than giving me a fish.

My knowledge here comes from repeated trial and error over a number of projects over a number of years. Hence I do not claim definitive knowledge. However, this process, if followed, will get you your fish and I will teach you how to fish as best as I know it!
There are two separate approaches required for this ... 'menu items' are not all added in the same way. I believe Microsoft changed how they added when they introduced the 'ribbon' and
RibbonX. First, Format Cells which is added the 'old way':To get the IDs for the menu items (
CommandBarControls) on the 'cell' menu, you can use this:From this you will see the ID for 'Format Cells' is 855 and so you can disable it using
Application.CommandBars("Cell").FindControl(ID:=855, Recursive:=True).Enabled = False(and obviously True to enable it).Next, New Note and New Comment which are added the 'new way':
These are added using RibbonX and you will need a RibbonX editor app to assist you with editing it ... there are a few RibbonX editors out there, I suggest Office RibbonX Editor (I have no affiliation with the author), you will need to read-up on how to use this. Once you have got the hang of how to add/edit RibbonX, you need to know that the
idMsofor New Comment isNewThreadedCommentand theidMsofor New Note isNewCommentLegacyand so the RibbonX code you will need is:The process for working out the
idMsovalues is not straight forward. However, the approach I used here (and have used before ... sometimes successfully and sometimes not) is: in Excel, go to: File > Options > Customize Ribbon, under 'Choose Commands From' select 'All Commands' ... at this point, then, you have to work out which command in the (very long) drop-down relates to the 'menu items' you want.In your case, scroll to Insert Comment (there are two on my device, it is the first) and hover the mouse over it, you will see
NewThreadedCommentin parenthesis at the end of the tooltip ... this is theidMsofor New Comment (why Microsoft uses Insert Comment in one place and New Comment in another I do not know ... part of the 'fun and games' of this is to work out what Microsoft called each item, there is no definitive way of doing this that I know of, you need to hunt around in the drop-down until you find the command you need); then scroll to New Note and again hover your mouse to find theidMsoisNewCommentLegacy. These are then used in the RibbonX, as above, to disable the relevant menu items.To read up more about RibbonX, including how to make the disabling/enabling dynamic (if that's what you need) using
getEnabled, see the Microsoft docs.