I used to interop with excel through C#. But after installed the latest version of Microsoft Office (now Microsoft 365) I got this error when I try to open excel:
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}'
These are the references:
This is the path for Microsoft.Office.Interop.Excel :
C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll
Can you help me to know, what I'm doing wrong?