Please note: This is a followup question to my previous post (517,535) which was solved by Hans (my hero). I made it a different thread because this is a totally different issue.
I now have very workable code to import and convert an ever-changing Excel spreadsheet into the tables I need. Actually, it works fine if I do the initial import manually, answering YES when asked if the 1st row contains field names. When I try to automate this import using the following line:
DoCmd.TransferSpreadsheet acImport, , “Test Procedures”, “C:SeanSDRL 006 Matrix.xls”, True
all my work goes down the drain because Access decides to name the table fields as “F1”, “F2”, etc. My Excel file does NOT have a header row, per se, because it is set up similar to an Access crosstab query or even more like a pivot table without any summing or counting of the actual data. I DO, however want to use the 1st row as field names – there is intelligence built into them that I need for the rest of the program to work.
I guess I actually have 2 questions:
1. How can I change my DoCmd.TransferSpreadsheet to keep the 1st row of the Excel file as table field names, and
2. How can I change the same statement to import data from another worksheet in the same Excel file. I need to refer to whatever data is actually on each worksheet, not a named range (#’s of rows and columns are constantly changing)
Can anyone help? No offense taken if you tell me I’m not being clear, this is tough to actually explain — I’m happy to clarify
Kathi