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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binding a data control to Excel

Status
Not open for further replies.

Beaner5434

Programmer
Jul 18, 2001
12
US
I am developing a VB6 app to process a number of Excel workbooks I receive every month. When I bind the workbook to a data control, however, it takes the first row of the Excel sheet as the Field name. Is there a way to get it to NOT do that (other than going in and manually inserting a new row with a dummy field name in cell A1)? The objective of the app is to automate the process w/o having to manually do anything to each file.

Here is the code I use to bind the Excel sheet to the data control ("xFile" containes the path and file to be processed):

Code:
   dbLawson.DatabaseName = xFile
   dbLawson.RecordSource = ""
   dbLawson.Refresh
   dbLawson.RecordSource = dbLawson.Database.TableDefs
(0).Name
   dbLawson.Refresh

Thanks for any guidance and help you can provide.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top