OfficeAddin 通过Winform程序调用 本机调试没有问题 其他机器上运行报错误 1C

Unable to cast COM object of type 'System.__ComObject' to interface type 'YJWordAddIn.IAddinUtilities'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{8D66A10E-47F2-33CA-B987-64DB9ECA6B1F}' failed due to the following error: 不支持此接口 (Exception from HRESULT: 0x80004002

(E_NOINTERFACE)).

调用代码:

object addinName = "WordAddIn";
Microsoft.Office.Core.COMAddIn addin = m_word.COMAddIns.Item(ref addinName);
if (addin.Connect)
{
WordAddIn.IAddinUtilities utils = null;
while (utils == null)
{
utils = (WordAddIn.IAddinUtilities)addin.Object;//此处报错
System.Threading.Thread.Sleep(100);
}
m_word.Visible = true;
m_word.Activate();//激活MSWord.Application 使其置顶

                    utils.CheckDocument(“2017”, “2017”,0,"");
                }

1个回答

有没有用 regasm正确注册,有没有正确安装.net框架,程序部署是否正确。有没有在注册表中注册加载项

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问