View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] sriram.rajamanuri@gmail.com is offline
external usenet poster
 
Posts: 1
Default Load a range of cells into a dataset with an opened workbook instance.

Hi,

I am kind of having to load a 'range' of cells into a dataset with an
instance of workbook that i have created. Is there a possibility that I
do it?

For eg.
Dim objExcel As New Excel.Application
Dim objWorkbook As Excel.Workbook
objWorkbook = objExcel.Workbooks.Open"C:foo.xls")
Dim objSheet1 As Excel.Worksheet = objWorkbook.Worksheets("Sheet1")
...
' Do some operations in the cells in the worksheet
...

Dim sConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<THIS IS WHERE I WANT TO
GIVE A RANGENAME FROM objWorkBook;Extended Properties=Excel 8.0;"
...
load the data into dataset etc.
Dim objCmdSelect As New OleDbCommand("SELECT * FROM RangeName",
objConn)



Any ideas?

Thanks in advance,
Sriram