S
Skifs
I have developed Shared Add-in for Word with vs2005 that adds a popup menu to
File menu with couple of Commands in it.
CommandBarPopup myPopupCommandBar =
(CommandBarPopup)wordApp.CommandBars["File"].Controls.Add(MsoControlType.msoControlPopup, missing, missing, missing, true);
I added buttons to that popup menu like this:
....
CommandBarButton newButton =
(CommandBarButton)myPopupCommandBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, missing, true);
....
I've assigned clickHandlers, captions, icons etc, and everything works great.
What I want to do now is to have some of my buttons disabled in some
situations.
For example, I want to have my Save button disabled(grayed out) when there
is no document opened in Word, just like built in Save and Save As...
commands.
I know that buttons can be disabled by setting their property Enabled=false
, but I dont know how to change my buttons properties depending on current
situation in Word.
I would have to somehow catch event when document is closed to disable my
buttons and catch event when document is opened to have them enabled again.
I've hit the wall with this please help me, thanks in advance for your
answers.
File menu with couple of Commands in it.
CommandBarPopup myPopupCommandBar =
(CommandBarPopup)wordApp.CommandBars["File"].Controls.Add(MsoControlType.msoControlPopup, missing, missing, missing, true);
I added buttons to that popup menu like this:
....
CommandBarButton newButton =
(CommandBarButton)myPopupCommandBar.Controls.Add(MsoControlType.msoControlButton, missing, missing, missing, true);
....
I've assigned clickHandlers, captions, icons etc, and everything works great.
What I want to do now is to have some of my buttons disabled in some
situations.
For example, I want to have my Save button disabled(grayed out) when there
is no document opened in Word, just like built in Save and Save As...
commands.
I know that buttons can be disabled by setting their property Enabled=false
, but I dont know how to change my buttons properties depending on current
situation in Word.
I would have to somehow catch event when document is closed to disable my
buttons and catch event when document is opened to have them enabled again.
I've hit the wall with this please help me, thanks in advance for your
answers.