Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading excel with ADO - listing worksheets?

Status
Not open for further replies.

djjd47130

Programmer
Nov 1, 2010
480
US
OK, I followed a tutorial (sorry lost the link) to use ADO to connect to an excel sheet. All works fine, except I can't figure out how to get a list of all the worksheets (which is treated as a table). I can get a list of tables in the object inspector in design-time, but that's not an option in run-time. In MSSQL, I know how to get a listing of tables with a SQL statement, but in this case I can't use SQL statements, and it's obviously not MSSQL.

I'm using a TADOTable component with JET 4.0 drivers, Extended properties = "Excel 8.0", and TableDirect = True. Also, haven't tried yet because I have Office 2003, but will this work with later excel files (.xlsx)? If not, what would I have to do?


JD Solutions
 
I found my answer... I'm not able to do it using the TADOTable directly, but after implementing a TADOConnection instead, then attaching the TADOTable to it, I can call TADOConnection.GetTableNames to do what I need.

JD Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top