I have Visual Studio 2015 and my application is for .NET Framework 4.0.
I installed Microsoft Office Home&Buissness 2016 and trying tocreate an instance using this code:
Microsoft.Office.Interop.Excel.Application excelAppTemplate = new Microsoft.Office.Interop.Excel.Application();
but I get this error:
Unable to cast COM object of type 'System.__ComObject' 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).
I am referencing Microsoft.Office.Interop.Excel 15.0.0.0. While searching for answers, I have seen a solution to delete this registry key:
HKEY_CLASSES_ROOT\TypeLib{00020813-0000-0000-C000-000000000046}
But I have 1.9 and not the previous version like 1.8 or 1.7, just 1.9. Is there any new version for Office 2016?