Method to refresh/update Word toolbar state

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

Method to refresh/update Word toolbar state
Guillaume Aimetti

Posts: 2
Joined: 2007-04-18

I am writing a COM add-in for Word which implements my own toolbars. On my (developer) PC the toolbar button states update automatically after exiting the method.

However, on the testing machine the state of the button changes but visually it does not. i.e. a method causes the toolbar to become disabled but the buttons appear, visually, to be enabled but its actual state is disabled. The buttons will refresh/update themselves after I do something with Word e.g. minimize and then maximize!!!

I have tried a ScreenRefresh method of the application object. Is there any other way of forcing an update on Word?


Posted 18 Apr, 2007 04:26:29 Top
Sergey Grischenko

Add-in Express team

Posts: 7233
Joined: 2004-07-05
Hi Guillaume.

Please try the following workaround to refresh the state of Office controls:

button.Width++; button.Width--;

P.S. Note that we take up your forum requests in the order we receive them. Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 18 Apr, 2007 10:44:33 Top
Guillaume Aimetti

Posts: 2
Joined: 2007-04-18
Hi Sergey,

I tried your workaround but it did not work. I did find a solution though:

if(commandBar.Visible == true)
commandBar.Visible = false;
commandBar.Visible = true;

Thanks for your help,

Posted 19 Apr, 2007 06:44:02 Top