Connecting Excel file via ADO.

  • Hello,

    I have problem of making connection to the Excel file with the following connection string...

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Test.xls;Extended Properties=Excel 8.0;"

    In the above connection string version is hadwired and so I changed it to....

    .Provider = "MSDASQL"

    .ConnectionString = "Driver={Microsoft Excel Driver (*.xls)}; DBQ=" & strWebFilePath & "; ReadOnly=False;"

    but I am still facing the problem. The following error I get when I try to make ADO connection to the Excel file....

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Excel Driver] External table is not in the expected format.

    Can anybody please help me in finding the solution please.

    Phill,

    I file is created in Office premium. Does that make difference??

    Regards,

    Mahesh

  • Try This .............

    Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strWebFilePath & ";Extended Properties="""";Excel 8.0;HDR=Yes;"

    Conn.Mode = adModeReadWrite

    Conn.Open

  • Hello All,

    the problem is in the file and from error itself we should understand that the given file is not a Excel file because it says External table is not in the expected format. Thanks all for your help.

    Regards,

    Mahesh

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply