question about opening an excel object

i need to make a simple program that loops though a list of excel files and copy/past 1 row to a master excel sheet.

i see that i have several options to create excel objects:

* using a connectionstring OLEDB
* use Excel Reference (Microsoft.Office.Interop.Excel)
* CreateObject("EXCEL.APPLICATION")

What's the best way to do this? i want the option that is less dependent on the excel version of the end user (so it should work on both Excel 2007 and Excel 2010). And i don't want to install extra drivers like a OLEDB connector.

I have Excel 2010 installed on my laptop, endusers have Excel 2003 or Excel 2007
Ollie90Asked:
Who is Participating?
 
CodeCruiserCommented:
If you want it to be version agnostic, use the dynamic approach (CreateObject).
0
 
raysonleeCommented:
I'd suggest using MS Office Interop. The latest version is backward compatible. Copy / paste of a row for Excel 2003 - 2010 should not have any problem.
0
 
Ollie90Author Commented:
ok, two different answers :)

my first thought was also interop because of the backward compatible ..

@CodeCruiser, why CreateObject instead of interop?
0
 
CodeCruiserCommented:
Microsoft does not guarantee that the Office PIAs will be backwardly compatible


http://support.microsoft.com/default.aspx?scid=kb;en-us;840585
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.