Knowledge Base Article

Home Page > Knowledge Base > Spira Platform

Home Page > Knowledge Base > Spira Platform > SpiraPlan

Home Page > Knowledge Base > Spira Platform > SpiraTeam

Home Page > Knowledge Base > Spira Platform > SpiraTest

Article Resolving 'Unable to cast COM object' errors when using MS-Office Add-Ins

by Adam S on Wednesday, December 9, 2015

Sometimes when using our MS-Office Add-Ins (for Excel, Word and Project) on a new computer you will see an error message of the type:

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Tools.Excel.Worksheet'. This operation failed because the QueryInterface call on the COM component for the interface with IID ...

This article explains the cause of these types of error and provides some common solutions

If you have different versions of MS-Office projects installed (e.g. Project 2016 and Excel 2013) on the same computer it will result in different versions of the MS-VSTO library being installed.

This is described in this Microsoft Developer Network (MSDN) blog:

"...So I rang the customer to discuss it further and it turned out that they installed Project 2010 to these boxes running Office 2007 that seemed to have added a newer automation class registry key for Excel though even though it was not even installed.

Anyway, deleting the key HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.7 solved the issue for the customer.

Project, Excel and Team Explorer work fine with that tiny little change

My learnings: “When in doubt, run process monitor.” Smiley...."

So, if you see this error, use the Windows Registry Editor (REGEDIT.EXE) and:

Remove the two keys:

  • HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.8
  • HKCR\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9

Then reinstall the MS-Office 2010+ add-in from our website, reboot and the issue will be resolved.  You should no longer receive the COM error:

Article Info
Last Updated: 12/9/2015
Article ID: KB180
# Views: 3868
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2017 | Licensed to Inflectra Corporation.