+ Reply to Thread
Results 1 to 7 of 7

Connection string ADO 2.8 library and Excel 2007 version 12

Hybrid View

  1. #1
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Connection string ADO 2.8 library and Excel 2007 version 12

    what is the connection string for using the :
    ActiveX Data Objects 2.8 library and ActiveX Data Objects Recordset 2.8 library

    to access an excel 2007 Application.version 12.0 Macro enabled workbook?

    I am running this under XP.

    In expectation of your help: thank you

    PS. I am using one worksheet as a data table.
    PPS. I have it running happily using the ActiveX Data Objects 6.0 library under Vista but have found the target machine only has 2.8 and it will be problematic to use anything different.


    click on the * Add Reputation if this was useful or entertaining.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Connection string ADO 2.8 library and Excel 2007 version 12

    Hi,

    For 2007, something like this:
               strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & _ 
                            "Data Source=" & strSourceFile & ";" & _ 
                            "Extended Properties=""Excel 12.0;HDR=Yes"";"
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Connection string ADO 2.8 library and Excel 2007 version 12

    For future ref. see: http://www.connectionstrings.com/

  4. #4
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Connection string ADO 2.8 library and Excel 2007 version 12

    Quote Originally Posted by Colin Legg View Post
    Hi,

    For 2007, something like this:
               strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & _ 
                            "Data Source=" & strSourceFile & ";" & _ 
                            "Extended Properties=""Excel 12.0;HDR=Yes"";"
    Thanks Colin, that is what he is tried with 2.8. It gives rise to an error: cannot update. Database or object is read only. He has tried it with both the original file and a new test spreadseet.

  5. #5
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Connection string ADO 2.8 library and Excel 2007 version 12

    Hi,

    Please post the code, including the query and the line where you open the recordset?

  6. #6
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Connection string ADO 2.8 library and Excel 2007 version 12

            With ThisWorkbook
                Set mCn = New ADODB.Connection
                str = ThisWorkbook.Path & "\" & mstrLocalDatabase
                With mCn
    ''                .Provider = "Microsoft.Jet.OLEDB.4.0"
                    .Provider = "Microsoft.ACE.OLEDB.12.0"
                    .ConnectionString = "Data Source=" & str & ";Extended Properties=Excel 8.0;"
                    .Open           'THIS IS WHERE THE ERROR OCCURS
                End With
            End With
    Thank you
    Last edited by DonkeyOte; 02-24-2011 at 08:11 AM. Reason: code tags corrected

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: Connection string ADO 2.8 library and Excel 2007 version 12

    The Extended Properties in your code are not what Colin posted.
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1