question about opening an excel object

Posted on 2011-10-03
Last Modified: 2012-05-12
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)

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
Question by:Ollie90
    LVL 9

    Expert Comment

    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.
    LVL 83

    Accepted Solution

    If you want it to be version agnostic, use the dynamic approach (CreateObject).

    Author Comment

    ok, two different answers :)

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

    @CodeCruiser, why CreateObject instead of interop?
    LVL 83

    Expert Comment

    LVL 83

    Expert Comment

    Microsoft does not guarantee that the Office PIAs will be backwardly compatible;en-us;840585

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now