Re: ADO with Excel using .csv? (VB6-Pro)



Paul Clement (VB MVP) on the microsoft.public.vb.database.ado forum found
the error of my ways (thanks again, Paul, if you happen to see this in this
forum).

I had misunderstood how to do it as explained at
http://support.microsoft.com/default.aspx?scid=kb;EN-US;257819
and had stipulated a connection string as:

strcon = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & csvFile & ";" & _
"Extended Properties=""Excel 2002;IMEX=1;HDR=YES"""

It should instead read:

strcon = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & csvFile & ";" & _
"Extended Properties=""Excel 8.0;IMEX=1;HDR=YES"""

The code then worked with a .xls type file just fine, I could iterate
through all the rows and columns, but it still won't work with a .csv export
of the same file, and gives a "Run-time error -2147467259 (80004005)
External table is not in the expected format." response. But the same .csv
file will load into Excel just fine if I double-click the .csv file, no
parsing errors are then apparent. I'm going to try to get around this by
using automation to make Excel itself load the .csv file and then to save it
as a normal .xls type file so that I can then use the above connection
string to move the Excel "records" over into Access. Unless someone can tell
me how to make the above connection string work with a .csv file, that is!



.



Relevant Pages

  • Re: read csv file in iframe as text file
    ... load it as a text file. ... finally opens it with excel in IE window itself. ... format only so that it can be edited externally with excel easily. ... Later on i want to display the read csv file in javascript and do some ...
    (comp.lang.javascript)
  • Re: read csv file in iframe as text file
    ... I am trying to load a csv file in Iframe element. ... finally opens it with excel in IE window itself. ... format only so that it can be edited externally with excel easily. ...
    (alt.html)
  • Re: How to get ADO 2.8 to obey HDR=NO ?
    ... By the way my program opens the CSV file, reads one line, and then closes the CSV file. ... Then my application constructs a connection string. ... I don't want to force the end user to put a header line in the CSV file, but the user can decide based on their own convenience. ... By the way when Excel opens the file, Excel always thinks there is no header record. ...
    (microsoft.public.data.ado)
  • read csv file in iframe as text file
    ... I am trying to load a csv file in Iframe element. ... finally opens it with excel in IE window itself. ... format only so that it can be edited externally with excel easily. ...
    (alt.html)
  • read csv file in iframe as text file
    ... I am trying to load a csv file in Iframe element. ... finally opens it with excel in IE window itself. ... format only so that it can be edited externally with excel easily. ...
    (comp.lang.javascript)