I am working on a shared addin for MS Word 2007. I would like to add a button which pops up when selected text is right clicked. The attached snapshot should make this clear.
Currently, the user has to select the text and then click a button on a custom control. It would be a lot easier if after selecting the text, s/he could right click it and press the relevant button in the popup.
You need to extend the correct contextmenu. The following link describes in words (no source code) how this can be achieved:
Maybe this Link might help a little with the coding. I haven't tried it out myself, but it might point into the right direction.
Good luck! :)
Edit:
Does it have to be the ribbon style context menu or would a button within the normal context menu be enough? In case the normal menu would be ok, you might use this way (C#):
Microsoft.Office.Core.CommandBar cb = this.Application.CommandBars["Text"];
Office.CommandBarControl newButton = cb.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, missing, missing);
newButton.Caption = "Test";
newButton.Visible = true;
newButton.Enabled = true;
You can do this with VSTO, I'm not so sure if it works exactly the same way with the shared Add-In technology, but maybe it does help ;)