Results 1 to 10 of 10

Thread: problem opening excel file thru ADO

  1. #1

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828

    problem opening excel file thru ADO

    Hello all,

    i've got this piece of code to open an excel spreadsheet using ADO, which has been working ok uptill now...

    VB Code:
    1. cnExcel.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    2.            "Data Source=" & strFilePath & ";" & "Extended Properties=""Excel 8.0;HDR=NO;IMEX=1"""
    3.     cnExcel.CursorLocation = adUseClient
    4.     cnExcel.Open
    5.    
    6.     rstImport.Open "SELECT * FROM [Sheet1$]", cnExcel, adOpenStatic, adLockReadOnly

    i've error trapped it and get an "unspecified error" on the last line.

    I'm using MDAC 2.7 (ADO 2.6) and i can't work out what the problem is coz i haven't changed the excel file...

    any ideas?

    darrel.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    (obvious question)

    Have you checked your project references since you installed MDAC 2.7 - to see if anything has the "MISSING" prefix.....
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    yup, thats all ok, project compiles without any problems too.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  4. #4
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    I just ran your code with a reference to the following:

    ADO 2.7

    ADO 2.6

    ADO 2.5


    with no probs........


    are you getting any error number at all....
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  5. #5

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    -2147467259

    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  6. #6
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    Try reinstalling MDAC and going again......
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  7. #7

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    i'll give it a go...
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  8. #8

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    nope, still buggered.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  9. #9

    Thread Starter
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    oh come on people, don't tell me i've got everyone stumped!



    anything else i can do to help you help me???
    more code etc???
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  10. #10
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    change your reference to ADO 2.7.....
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

Posting Permissions

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



Click Here to Expand Forum to Full Width