Hi.

I have a routine using the OleDb provider to read an Excel worksheet.
The code works well, except when I need to read data from non
adjacents ranges. In this case I receive all sort of errors. I need to
select data from A11:B37 and E11:J37. I tried these expressions but
none of them did the job:

Dim da As New OleDbDataAdapter("Select * from
[Resume$A11:B37;$E11:J37]", conn)

Dim da As New OleDbDataAdapter("Select * from
[Resume$A11:B37;Resume$E11:J37]", conn)

Dim da As New OleDbDataAdapter("Select * from
[Resume$A11:B37];[Resume$E11:J37]", conn)

How do I select non adjacent ranges in a Excel worksheet?

Thanks,
Robert Scheer

Re: Reading Excel ranges by Paul

Paul
Tue Dec 07 09:19:04 CST 2004

On 7 Dec 2004 05:33:24 -0800, rbscheer@my-deja.com (Robert Scheer) wrote:

¤ Hi.
¤
¤ I have a routine using the OleDb provider to read an Excel worksheet.
¤ The code works well, except when I need to read data from non
¤ adjacents ranges. In this case I receive all sort of errors. I need to
¤ select data from A11:B37 and E11:J37. I tried these expressions but
¤ none of them did the job:
¤
¤ Dim da As New OleDbDataAdapter("Select * from
¤ [Resume$A11:B37;$E11:J37]", conn)
¤
¤ Dim da As New OleDbDataAdapter("Select * from
¤ [Resume$A11:B37;Resume$E11:J37]", conn)
¤
¤ Dim da As New OleDbDataAdapter("Select * from
¤ [Resume$A11:B37];[Resume$E11:J37]", conn)
¤
¤ How do I select non adjacent ranges in a Excel worksheet?

AFAIK the ISAM driver can only handle the first range you specify as the source, which identifies
the logical starting and ending point of the data that will be queried in the Worksheet.


Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)