How to load/unload Word Add-in programatically?

随声附和 提交于 2019-12-02 09:49:55

I had similar requirement and achieved it by little cheat.

I had a addin called AddinLauncher (with no ribbons) which will look for the user type and launch or closes the other addin.

This code was called during AddinLauncher Addin Startup event.

foreach (COMAddIn addin in Globals.ThisAddin.Application.COMAddins)
{
  if (**specify your own condition**)
    {
        addin.Connect = true;
    }                       
}

The following changes are required in your deployment

The Loadbehaviour for AddinLaucher addin is 3 and all the other addins are 0. More about Loadbehaviour here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!