Reading Excel ranges

  • Thread starter Thread starter Robert Scheer
  • Start date Start date
R

Robert Scheer

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
 
On 7 Dec 2004 05:33:24 -0800, (e-mail address removed) (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 ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top