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:

 

http://blogs.msdn.com/b/dau-blog/archive/2012/04/20/how-to-solve-unable-to-cast-com-object-of-type-microsoft-office-interop-excel-applicationclass-to-interface-type-microsoft-office-interop-excel-application.aspx

"...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.”...."

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:

Attachments

Selected files will be attached to any email sent on saving ticket.

file selected files selected  () Delete Selected

  • Created:
  • by:

Select files to upload

Or drag and drop files here

Uploading …
Done!
Upload More?
There was an error.
Try again?

Save to upload the selected file(s)

Article Info
  • Last Updated: 3/7/2017
  • Article ID: KB180
  • Views: 11579