Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass'

Trevor Strike 1 Reputation point
2022-05-19T19:22:23.917+00:00

Hello, I have been developing an application to take a file that has been exported from the web and open it up. I have it working completely for 64 bit office, but I am running into issues trying to get it to work for 32 bit office. Here is the Error I am getting:

Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Element not found. (Exception from HRESULT: 0x8002802B (TYPE_E_ELEMENTNOTFOUND)).

I have tried all that I have found on line to do. I started with deleting all the platforms. I was not able to delete all, until I recreated one of the others that were deleted. I tried both copying from old ones and also copying from empty. These all resulted in the same error. I can open and run the full process on my machines with 64 bit office, but no one with 32 bit office can run this. When I look at the registry, non of the machines have a key for {000208D5-0000-0000-C000-000000000046}. all the keys are {00020813-0000-0000-C000-000000000046} that relate to Excel. I am unable to add to the key it is referring to.

I initially was using Microsoft Excel 16.0 Object Library and was getting a similar error but was mentioning key {00020813-0000-0000-C000-000000000046} instead. I switched to Microsoft.Office.Interop.Excel 15.0.0.0 per other discussions I had seen on the web. This is when the error switched to {000208D5-0000-0000-C000-000000000046}. I am currently at a loss of what to do to fix it so that users are able to use this on a 32 bit office machine. Thank you for your help.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,005 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Johan Valstar 11 Reputation points
    2023-09-14T12:47:00.4366667+00:00

    I have seen this issue many times. You can resolve this by repairing office. It will work again but might be popup later again and repairing it again will solve the issue again.

    1 person found this answer helpful.

  2. Anonymous
    2023-02-09T17:15:40.8733333+00:00

    Hello, I'm experiencing the same issue which Trevor described. What there a resolution to this issue?


  3. Karen Payne MVP 35,436 Reputation points
    2024-07-24T22:33:33.9833333+00:00

    Even though this is an old question its worth mentioning use NuGet package ExcelMapper which is easy to use and well documented.

    See my article using ExcelMapper C# Excel read/write on the cheap.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.