Excel ribbon customisation - contextmenus

I have created an Excel addin (XLAM file) which has completely custom ribbons (i.e. I have used 'StartFromScratch in the XML).

I now wish to add some items to the cell context menu. I know how to do this (via the '<ContextMenus> element and children) but the problem is that I don't want to leave any of the standard commands on the context menu - except those that I add.

Is there a quick way to hide all the in-built menu items (like a 'StartFromScratch' for the <ContextMenus> block) ?

I know if course that I can hijack the default menu items via 'idMSO' and then set the visibility to false but I want to avoid the time it takes to do this for every item.

Can anyone help ?
LVL 3
AL_XResearchAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ProfessorJimJamCommented:
i am not sure if i understood your question correctly.  but to remove all built in meny from cell or from any other then you might wanna try the free Add-IN  MenuRighter  http://yoursumbuddy.com/menurighter/
  then from the drop down in the right select Cell and then from the right icons select remove and you can remove all of them except one last one.   and in case if you wanted to restore to default, then you just simple click reset to default.
0
AL_XResearchAuthor Commented:
'ProfessorJimJam' thanks for the quick response.

To clarify; I want to know if there is a quick way to remove / hide all items in the cell context menu using only RibbonX XML

I will keep that tool in my box of resources, thanks. Unfortunately on this project third party addins are not an option.

I have coded a completely unique ribbon for this addin that replaces all Excel tabs and groups.

I just want to know how do to clear the context menu quickly in RibbonX - other than the methods I have already covered.
0
Rory ArchibaldCommented:
As far as I am aware there is no equivalent to startFromScratch for contextmenus.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

AL_XResearchAuthor Commented:
Anyone ?

Even the XML to disable all default context menu controls would help.
0
AL_XResearchAuthor Commented:
Any suggestions or control names would be appreciated because I have the complete list of Excel controls (from MS in an Excel workbook) and I can't find any controls for 'ContextMenuCell'
0
AL_XResearchAuthor Commented:
Of course I realise that I could use the Commandbars object to hide the existing controls but a) I don't know how long MS are going to keep Commandbars in VBA and b) I would rather not crate a Ribbon X + Commandbars mixed solution.

Someone out there must have some knowledge on how to either clear the context menu, the control names for all it's items so they can be made invisible or some other method.

I really need a solution here. No third party addons or anything that requires installation can be used.
0
ProfessorJimJamCommented:
this example can get you started.  with customUI editor, using the example below, you have to do it it per menu.


<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <contextMenus>
        <contextMenu idMso="ContextMenuCell">
            <gallery idMso="PasteGalleryMini" visible="false"/>
        </contextMenu>
    </contextMenus>
</customUI>

Open in new window

0
AL_XResearchAuthor Commented:
ProfessorJimJam: thank you for the quick response.

I already have this code and have successfully added my own custom button to the cell context menu but I need to hide (i.e. 'visible=false') all the built in Excel commands on the 'ContextMenuCell' menu

Unfortunately the MS download, that supposedly lists all the ribbonX controls for Excel 2010' does not include any child controls for 'ContextMenuCell' - hence my appeal for other Excel experts to come to the rescue.
0
Rory ArchibaldCommented:
See the bottom of this article: https://msdn.microsoft.com/en-us/library/gg469862.aspx#odc_xl_ta_CustomExcelContextMenus_ContextMenuTipsTricks

Essentially, there is no list available, so you need to use code to hide them.
0
ProfessorJimJamCommented:
Rory is right,  i am  not aware of a place where you can get the code ready from there either.

i am afraid, you have to built it up by your self.  in the attached code below, you almost get most of it, except few missing, also if the cell is in the table range, then the contextmenucell will have addtional menus, which you can also disable. you mentioned that you have the excel file that has all the detail in it, so you can use that to build up the code.

attached is the Excel Control list, in case if you do not have the updated one.

in addition, you may also use Andy pope's RibbonX visual designer where you do not need to write any code, simply add commands and then select the menu which you want to disable and set the "enabled" to false and also you can view the generated xml code in there too.  download link http://www.andypope.info/vba/ribboneditor_2010.htm 

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <contextMenus>
        <contextMenu idMso="ContextMenuCell">
        <button idMso="Paste" enabled="false"/> 
       <button idMso="Copy" enabled="false"/> 
       <button idMso="Cut" enabled="false"/> 
        <gallery idMso="PasteGallery" enabled="false"/>
        <gallery idMso="PasteGalleryMini" enabled="false"/>
        <gallery idMso="PasteMenu" enabled="false"/>
        <gallery idMso="PasteLink" enabled="false"/>
        <gallery idMso="PasteAsHyperlink" enabled="false"/>
        <gallery idMso="PasteSpecialDialog" enabled="false"/>
        <gallery idMso="PasteFormatting" enabled="false"/>
        <gallery idMso="PasteFormulas" enabled="false"/>
        <gallery idMso="PasteValues" enabled="false"/>
        <gallery idMso="PasteFormulasAndNumberFormatting" enabled="false"/>
        <gallery idMso="PasteTranspose" enabled="false"/>
        <gallery idMso="PastePictureLink" enabled="false"/>
       <button idMso="CellsInsertSmart" enabled="false"/> 
      <button idMso="FormatCellsDialog" enabled="false"/> 
     <button idMso="CellsDeleteSmart" enabled="false"/> 
     <button idMso="CellsDelete" enabled="false"/> 
     <button idMso="NameDefine" enabled="false"/> 
       </contextMenu>
    </contextMenus>
</customUI>

Open in new window

ExcelControls.xlsx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AL_XResearchAuthor Commented:
ProfessorJimJam, thank you so much. That is exactly what I was looking for

I am trying your example XML and it does remove 80% of the cell context menu items.

I have used Andy Pope's ribbon editor before but for the life of me could not remember what it was called and so was unable to search online directly.

As I say I am looking to nail down the last few context menu items and when I do I will update this question so no one else has to go the tedious trial and error route.
0
ProfessorJimJamCommented:
Thank you AL XReseach
0
AL_XResearchAuthor Commented:
ProfessorJimJam:

in addition, you may also use Andy pope's RibbonX visual designer where you do not need to write any code, simply add commands

Unless I am missing something Andy's excellent little tool does not allow you to create / edit context menus. Please tell me I am wrong.
0
ProfessorJimJamCommented:
You can but you need to look for it on Andy's guide page on how to do it.
0
AL_XResearchAuthor Commented:
ProfessorJimJam, thanks again, I am working on multiple developments so  please be patient between my replies. I am continuing to investigate this.
0
AL_XResearchAuthor Commented:
ProfessorJimJam, can you direct me to the correct page on Andy Pope's website, you previously mentioned, that covers the cell context menu. I have searched his site and can find nothing that mentions it

You can but you need to look for it on Andy's guide page on how to do it.

Thanks.

Even using your excellent XML example for the cell context menu, I am still left with the following commands on the right-click. I am using trial-and-error to try and find the correct MsoID to control them but have so far failed.

Paste Speical
Insert ...
Clear contents
Filter (menu)
Sort (menu)
Insert Comment
Pick from Drop Down List
Hyperlink
0
AL_XResearchAuthor Commented:
Anyone else can chip in of course ....
0
AL_XResearchAuthor Commented:
So far the only success I have found is :

<button idMso="HyperlinkInsert" visible="false" />

Open in new window

0
AL_XResearchAuthor Commented:
I can find no documentation or article online that details the XML code for the outstanding context menu items.

For the moment I just have to accept that there is no way to remove these items using only RibbonX
0
AL_XResearchAuthor Commented:
Anyone else have any ideas ?
0
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.