Hi, I have developed an application which imports data into Microsoft Excel.
Am using VS2005 + .NET 2.0 and Microsoft Office 2007 is installed on my machine (Office 12).
The compiled application works fine if I run it in my machine, but when I deploy the application to other machines say those using lower versions (Office 2000), I am getting the error:
Could Not Load File or Assembly Microsoft.Office.Interop.Excel, Version 12.0.0.0
How would I then enable my application execute properly regardless of the Office (Excel) installed on the machine?
Thanks.
Some Updates: I placed the two DLLs referenced, namely Microsoft.Office.Interop.Excel.dll (Version 12.0.0.0) and Office.dll (Version 12.0.0.0) in my bin folder. I have set the properties for this reference to Copy Local = True and when I compile my application, the DLLs are copied in the debug / release folder.
Now, when I try to run the application, I already got out of the error: "Could Not Load File or Assembly Microsoft.Office.Interop.Excel, Version 12.0.0.0"
but another error came up which is: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout, Object Local)
So, how do I actually create an application which would be able to export the datatable data into Excel regardless of the version of Office installed?
Thanks.