Enable/Disable menu/toolbar button in Word/Excel

Add-in Express™ Support Service
That's what is more important than anything else

Enable/Disable menu/toolbar button in Word/Excel
 
Rafal Piotrowski




Posts: 12
Joined: 2005-08-26
I have a Addin that when initialized it should start with all buttons disabled, then I do some work in background and if everything is fine I enable the buttons. this seems to work the first time the addin runs, but when I exit the host instance (word or excel) and enter the next time the buttons that were enabled at the end of the previous session are still enabled even if I set their Enabled property to false (which BTW should be false by default).

Do I need to do some special operation to disable the buttons? Setting their Enabled property to true seems to work but to false does not.

Many thanks,
/rp
Posted 26 Aug, 2005 02:56:38 Top
Rafal Piotrowski




Posts: 12
Joined: 2005-08-26
Found the problem.
to disable the buttons I was using AddinBeginShutdown which was not disabling them at all. So instead I am using AddinStartupComplete to disable them.

In I had to use AddinStartupComplete because the command bars are not available before (i.e. in AddinInitiaize)

regards
/ro
Posted 29 Aug, 2005 05:36:02 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Hi Rafal.

The point is that, ADX initializes all controls first time when an add-in
starts. If you enable the buttons manually in the code you also should return the previous state of the buttons manually. You can do it in the AddinStartupComplete event handlers.
Posted 29 Aug, 2005 19:40:07 Top
Rafal Piotrowski




Posts: 12
Joined: 2005-08-26
yea, that's what I do. Thanks.
/rp
Posted 02 Sep, 2005 08:14:15 Top