Link to home
Start Free TrialLog in
Avatar of Corny
Corny

asked on

How do I get Fields from an Excel File

I have opened Excel files as database files before,  but I used row 1 cells as the field names.
Example:


ExcelFile = "c:\Bin3\AS400FeedFormulationsDownload-6.xls"

Set db = DBEngine.Workspaces(0).OpenDatabase(ExcelFile, False, False, "Excel 8.0; HDR=YES;")
WorkSheetName = "Sheet1"
Set rs = db.OpenRecordset(WorkSheetName & "$", dbOpenTable)
Do Until rs.EOF
  With rs
    .Edit
    E(R, 1) = !Location

etc..etc

'---------------
The  !Location is the "header" on column 1 , row 1.  I'm asking if column1, row1 has no text, what do I use for fields?
ASKER CERTIFIED SOLUTION
Avatar of Jon_Raymond
Jon_Raymond

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Corny
Corny

ASKER

No, I haven't tried your suggestion.  I did solve my problem by putting in my headers and them making them invisible by using a font color the same and the background.  Thanks for you suggestion.