Article ID: 313948 - View products that this article applies to.
This article was previously published under Q313948
When you add a menu item to Microsoft Word from a Visual Basic COM add-in by using the steps in the following article or by using a similar method, the menu item does not work as expected:
(http://support.microsoft.com/kb/238228/ )How to build an Office 2000 COM add-in in Visual Basic
This problem occurs because Word requires the menu item to be unique. If the menu item is not unique, Word loses its reference to the CommandBarControl object.
Only Word has this requirement. Microsoft Excel and Microsoft PowerPoint do not. Therefore, if you use the same code to add controls in PowerPoint and Excel, the code works as expected.
The following resolution comes verbatim from the top of page 319 in the Microsoft Office XP Developers Guide (Microsoft Press, ISBN 0-7356-1242-0):
If your add-in will run in Word, you must also set the Tag property for the CommandBarButton object to a unique String value. This makes sure the command bar button will respond to the Click event and load the add-in for each new document window that the user opens. Because the Tag property provides you with additional information about the control, it is a good idea to set the Tag property for a command bar button that loads a COM add-in in any host application.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Article ID: 313948 - Last Review: January 31, 2007 - Revision: 3.2
Contact us for more help