How can I fix 0x8002802B (TYPE_E_ELEMENTNOTFOUND) issue without repair Microsoft 365?
I have develop a tool which is using Microsoft.Office.Interop.Excel.Application and Microsoft.Office.Interop.Excel.Workbook to operate Excel. It can work well, but when my office get update from IT, my tool will get exception:
System.InvalidCastException: 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 can fix this exception with repair Microsoft 365, but next time, when I get new office update, my tool will get the same exception again and I need to repair Microsoft 365 manually again.
I check with IT, below is the Q&A:
Q: I want to know why I need to repair Microsoft 365?
A: The repair is to be able to fix the COM in the dll level
Q: Does IT do any update for my computer?
A: From time to time, windows will push the updates to all the company's machine based on the company security policy. The patch that is being updated is sent by the developer to all the machines that runs windows 10/11 regardless of the organization.
I wonder to know do we have any other solution to avoid 0x8002802B exception?
Looking forward to any reply, thank you!