On 7 Dec 2005 11:44:36 -0800,
za***@construct ion-imaging.com wrote:
¤ Can this driver return to me the names of the active WorkSheets in an
¤ XLS file?
Not really no. If you want a list of Excel Worksheets use the Jet OLEDB Provider with the Excel ISAM
driver and GetOleDbSchemaT able:
Dim ExcelConnection As System.Data.Ole Db.OleDbConnect ion
Dim ExcelTables As DataTable
Try
ExcelConnection = New
System.Data.Ole Db.OleDbConnect ion("Provider=M icrosoft.Jet.OL EDB.4.0;" & _
"Data Source=e:\My Documents\Book1 0.xls;Extended Properties=Exce l 8.0;")
ExcelConnection .Open()
ExcelTables =
ExcelConnection .GetOleDbSchema Table(System.Da ta.OleDb.OleDbS chemaGuid.Table s, New Object() {Nothing,
Nothing, Nothing})
Dim RowCount As Int32
For RowCount = 0 To ExcelTables.Row s.Count - 1
Console.WriteLi ne(ExcelTables. Rows(RowCount)! TABLE_NAME.ToSt ring)
Next RowCount
frmMain.DataGri d1.DataSource = ExcelTables
Catch ex As Exception
MessageBox.Show (ex.Message)
Finally
ExcelConnection .Close()
End Try
Paul
~~~~
Microsoft MVP (Visual Basic)