ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Load a range of cells into a dataset with an opened workbook instance. (https://www.excelbanter.com/excel-programming/330528-load-range-cells-into-dataset-opened-workbook-instance.html)

[email protected]

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



All times are GMT +1. The time now is 01:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com