Tag: office 2007

访问COM组件时出错

我为Microsoft Office Word构build了一个加载项。 当Word以pipe理员身份运行时,使用外接程序时没有问题,但是如果没有以pipe理员身份运行Word,则存在两个访问function区元素的常见exception。 第一个例外: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.IRibbonUI'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C03A7-0000-0000-C000-000000000046}' failed due to the following error: could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND)). at Microsoft.Office.Core.IRibbonUI.InvalidateControl(String ControlID) 当控制被以下代码无效时,会发生此错误: ribbon.InvalidateControl("control-id"); 而第二个例外: […]