Click here to Skip to main content
15,883,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a context menu for Word 2010. I'm using the code below, but doesn't work when editing a table, i.e., the context menu doesn't show when entering text inside a table cell.
I tried this with the following contextMenu idMsos: ContextMenuTable, ContextMenuTableCell, ContextMenuTableCellWhole, and ContextMenuTableCellWholeLinked; but still doesn't work.
The context menu doesn't show when editing table.

What am I doing wrong? Thanks.

XML:
HTML
<contextMenus>
      	<contextMenu idMso="ContextMenuText">
			<menuSeparator id="CMenuSeparator1" />
			button id="BtnCMenu1" label="Block Text" imageMso="TextToolMenu" visible="true" onAction="StyleBlockText" />
      	</contextMenu>
</contextMenus>


VBA:
VB
Sub StyleBlockText(control As IRibbonControl)
    Selection.Style = ActiveDocument.Styles("My Style")
End Sub
Posted
Updated 9-May-14 7:14am
v3

1 solution

You did not specify what kind of issue do you have.

Here is a complete tutorial: Customizing Context Menus in Office 2010[^]
and Add-in that lists the IDs (idMSOs) of context menu controls is now available[^]
 
Share this answer
 
v2
Comments
MikeRC 9-May-14 13:21pm    
Found the correct idMso in the list, I should be using "ContextMenuTextTable". Thanks a lot.
Maciej Los 9-May-14 13:27pm    
You're welcome ;)
How many stars is worth my answer? :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900