unhandled exception of type 'System.InvalidCastException'

0

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: Interface not registered (Exception from HRESULT: 0x80040155).

The error occurs in the line excel1.Visible.

var excel1 = new Excel.Application();
excel1.Visible = true;

Not able to execute the above statements. I am using office 2016 and Visual Studio 2015. What could be the possible solution for such errors. Also no conflicting reg keys present in the system for Excel. how can to use VS 15 with office excel 16??

c#
excel
interop
office-interop
asked on Stack Overflow Feb 9, 2017 by Vishal Paul • edited Feb 9, 2017 by klashar

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0