I just spent a couple hours figuring out how to create a pivot table on an Excel spreadsheet via code. The reason I took so long is because I added a reference to the Excel Interop 12.0, rather than the Excel Interop 11.0.

I assume that 12.0 is for Excel 2007, while 11.0 if for 2003 (or whatever I have). If that assumption is correct, this will cause me a bit of trouble, as all the people using the program are in the process of moving from 2003 to 2007, and I should have moved myself, but didn't for some reason unknown to me (I thought the upgrade was pushed out to my computer when I was at work, but I don't seem to have it anymore, so I guess I was dreaming).

However, my concern is that the objects needed to create a pivot table in the 12.0 library are significantly different from the objects needed to create a pivot table in the 11.0 library. I don't believe I can late bind to solve this, because there will need to be different steps taken depending on the version, since the objects have different interfaces.

Does anybody have any experience with this? It appears to pertain only to pivot tables (for what I'm doing), as I was able to create the workbook, the worksheets, and export all my data with some old code that I had, and all of that worked with both libraries, the difference is just with the pivot tables because the interfaces have changed, such that the methods needed for one library don't even exist in the other one (and the code crashes, but that's probably because I have the PIAs for 2003 installed, and not 2007).