MarkJ
MarkJ

Reputation: 30398

Read XLS file from VB6

How can I read an XLS file from VB6? I don't want to use ADO or Automation.

I'm hoping for recommendations based on experience - I know how to Google :)

Upvotes: 2

Views: 1057

Answers (2)

richardtallent
richardtallent

Reputation: 35363

To make the ADO driver a bit more reliable, you can use add two pieces to your connection string:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\blah.xls;Extended Properties="Excel 8.0;HDR=YES;IMEX=1;MAXSCANROWS=12"

That will force the driver to scan 12 rows before making a decision on data types.

Upvotes: 0

wqw
wqw

Reputation: 11991

ADO

For IMEX=1 setting HKLM\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel\TypeGuessRows to 0 does miracles. I'm wondering if this can be supplied as a parameter of the connect string.

Upvotes: 1

Related Questions