So far, I got it to work in WL6, at least somehow:
QUOTE:
However, if VSTO installer adds them to the GAC, skip step #1 and just look for "Microsoft.Office.Interop.Excel" on the WL Editor's "NET Framework" tab and enable it.
This did not work as it did not show up in WLs References, despite the fact that I found it in the GAC - whatever mysterious the GAC might be (found it with "Everything", the best search tool in the (Windows) world, by far).
Then I figured that I had three Microsoft.Office.Interop.Excel.dll's on my PC. Why? I don't know! Mabye all three of them were installed with the vstor40_x64.exe installation? So I tried the newest under ...Visual Studio 10.0\...\Office14 - which did not work (I guess Office 14 = Office 2010 which I don't have installed yet). Then I tried to reference to ...Visual Studio 9.0\...\Office12 and I got it to work. Well, as I said, somehow:
I have add 'using Microsoft.Office.Interop.Excel;' but still I cannot get it to recognize that namespace (or however such things are called betweend developer when they sit together and laugh at normal human beings). So I still hat do enter things like 'Microsoft.Office.Interop.Excel.Application app;' instead of 'Excel.Application app;' for everything, but not for 'Workbook.book;', which is the only thing getting an error when I tried 'Microsoft.Office.Interop.Excel.Workbook book;'.
Okay, so be it. Or not. Later that night I figured (some remark in the www) that I better might change 'using Microsoft.Office.Interop.Excel;' to 'using
Excel = Microsoft.Office.Interop.Excel;'!? But when I tried, tired as I was, it showed me other errors, so I don't know (yet) if this is the way to go.
But I had to modify the sample code from dansmo (thank you for posting it here - such things always help a lot), like:
CODE:
Please log in to see this code.
This was also mentioned on many websites, that to open one has to add those many strange things MS requests for Excel, using 'Type.Missing' helps to avoid setting all those parameters, at least for my test. '.Open(@"...")' alone as in dansmo's example did not work for me. I also had to use other commands to read/write in Excel. Again, I have Excel 2007 installed (and using to write in an xls document in prev. version 2003, so not an xlsx).