I am developing an Autodesk Revit addin that communicates with Excel and performs some standard read/write operations on cells. I have referenced Microsoft.Office.Interop.Excel (v12.0.0.0), because some users might have Office 2007 installed instead of 2010 or later. I use Visual Studio 2013. Here is the beginning of the code;
Excel.Application xlApp;
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;
xlApp = new Excel.Application();
However, on some computers this returns the folowing error:
Revit encountered a System.Runtime.InteropServices.COMException(0x80040154): Retrieving the COM class factory for component with CLSID (00024500-000-0000-C000-000000000046) failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
It works on several computers that are 64-bit/32-bit, have Office 2007/2010/2013 installed. But it also doesn't work on other computers that have the same specs. How can I find out what is wrong?
EDIT: The error is returned at this specific line: xlApp = new Excel.Application();
Someone suggested registering the dll, but that doesn't work for Microsoft.Office.Interop; HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))