首页 > 代码库 > 解决安装不同版本office后造成的PIA COM组件调用失败

解决安装不同版本office后造成的PIA COM组件调用失败

症状:TF400422, TF400423, TF400424: Failed to open in Microsoft Excel (Project, Outlook): Unable to cast COM object of type ‘Microsoft.Office.Interop.Excel(Project, Outlook).ApplicationClass‘ to interface type ‘Microsoft.Office.Interop.Excel._Application‘. This operation failed because the QueryInterface call on the COM component for the interface withIID ‘{00063001-0000-0000-C000-000000000046}‘ failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))

如下图:



  • 原因:  先后安装了不同版本的office 造成系统注册表键值混乱。


解决方法:

Sounds like you have a problem with your typelib registration.  Presumably, the Com interop layer is hitting the registry to try to locate the typelib.  It would start by looking under HKEY_CLASSES_ROOT\Interface\{00063001-0000-0000-C000-000000000046}\Typelib.  

Removing an Office version and installing an older one, is probably what caused it. The newer version may have left some junk in the registry.
I had the same case, and this is how got over:

Notice the registry keys mentioned eariler:

HKEY_CLASSES_ROOT\Typelib\{00062FFF-0000-0000-C000-000000000046}.  There should be a version subkey 

If there is more than one version sub key (which is possible if you removed a newer version of Outlook) you should remove the one that refers to the version not installed: