Sheet's names

I want to create a DataSet from an excel without knowing the name(s) of the sheets inside.

Is it possible to get the names of the sheets using OLE DB Provider ? So a I can perform several SELECT orders to get each sheets as a DataTable, then insert it into a DataSet.

If you know an easiet way to get a DataSet from an excel file, please do not hesitate.

Thank you.
Dadou

2 answers

Hi,
if you mean something like (my VB6 sample)

With ExcelConn
.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ExcelFileName & ";Extended Properties=""Excel 12.0;HDR=YES;IMEX=0;ParamCheck=False"""
.CursorLocation = adUseClient
.Open
Set ExcelSchema = .OpenSchema(adSchemaTables)
end with

Note that ExcelSchema recordset contains now the n# of sheets and the sheet names are stored into ExcelSchema.Fields("TABLE_NAME").Value

Hope being of help!

hi,
i m new to this environment. can u explain me how can i get all the column names from a sheet.I have more than one sheet in my workbook and i want to get the column name from all sheet names.

thanks!!!!!