Hi Dave,
My name is Steve Danielson from the Office Integration team and I will be
assisting you with this question. The functionaility that you desire
(something similar to a "BeforePopup" event that is fired before the
CommandBarPopup's menu is displayed) does not exist. There have been
similar requests for this functionality, and this product suggestion has
been submitted up to the Word/Office development team. The product team
does take these seriously, and if you wanted to submit this item (the more
submissions the higher the priority) you could do so here:
http://register.microsoft.com/mswish/suggestion.asp
You said that you were using Word, and that you had 3 menu items that you
wished to synchronize with the position of the caret in the document. You
said:
Under the AutoTag menu I have the menu items "Insert Tag", "Edit Tag", and
"Delete Tag". When the AutoTag menu is displayed, I need to enable/disable
menu items depending on the location of the caret in the Word document.
If the caret is on a tag, I enable "Edit Tag" and "Delete tag" and disable
"Insert Tag". If the caret is not on a tag then I enable "Insert Tag" and
disable "Edit Tag" and "Delete tag".
Are you working with an XML document with an attached schema with Word
2003? Word 2003 has a new event called XMLSelectionChange. Is this
appropriate for your use?
If not, then you are limited in your choices. One choice is to Optimize
your WindowSelectionChange the best that you can. You could back this up
with checking in your Click Event Handlers to be sure that the wrong
actions are not executed at the wrong time.
Another option would be to replace those three CommandBarButtons and
CommandBarPopup with a CommandBarButton that displays a modal dialog with
the choices. I realize that this would add extra steps and may reduce the
usability of the application, in the Click event for the button you would
be able to check the state and properly initialize the dialog.
For information and sample code for integrating Office with Visual Basic,
Visual C++, Internet Scripts, and other programming languages, please see
http://msdn.microsoft.com/library/techart/VSOfficeDev.htm. This site
contains the most up-to-date information for using developer tools for
Office integration and extensibility.
Thanks,
Steve Danielson, MCSD.NET
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? Please visit the Microsoft Security & Privacy Center
(
http://www.microsoft.com/security) for the latest news on security updates.