Menus for VSTO Smart Tags are dynamic
One quick tip today. Since VSTO Beta2 we have added SmartTags support for document level customizations. How to create those is covered by Paul Stubbs here and in a video tutorial here . However what is not obvious is that one can dynamically change the caption on the menu items displayed for a particular SmartTag. The SmartTag class has a collection of Actions that represent the menu item. The Action class exposes BeforeCaptionShow event. One can register an event handler for this event. In the event handler just change the value of your Action.Caption property to whatever string value you want. Since the tagged text, the property bag and the either Word's or Excel's Range object are passed in as parameters you can make quite educated decision about what the caption should be. If you set the value to an empty string (either null or String.Empty) the corresponding menu item would not appear at all. On the related note, do not use this event handler for actually modifying the range object. This event is only designed to get values from the OM and set the Caption property.