how to enable/disable menu item of word addin when word is running?

J

jerry051

just like title, how to enable/disable menu item of word addin when word is
running? button's enable/disable is work well ,but menu item's
enable/disable isnot work. my code as:

CommandBarButton btnLogout =
(CommandBarButton)wdApp.CommandBars.FindControl(oMissing,oMissing,"btnMyLogo
ut" + ,oMissing);
CommandBarButton mnLogout =
(CommandBarButton)wdApp.CommandBars.FindControl(oMissing,oMissing,"menuMyLog
out" + ,oMissing);

if (isLogin)
{
btnLogout.Enabled = true; //work well;
mnLogout.Enabled = true; //not work;
}
else
{
btnLogout.Enabled = false; //work well;
mnLogout.Enabled = false; //not well;
}

when addin is loading,menuItem's Enabled property could be set true or
false, then it work well. but once it has been loaded complete, then set
menuItem's enabled property is not work. how to resolve this? thanks a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top