I am using the following code to import a spreadsheet into my Access 2003 tblWeekly table:
Expand|Select|Wrap|Line Numbers
- DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tblweekly", strOutFile, True, "impData"
I can't find any thread showing how to do this or if it's possible. I have not tested, but if the table field names match the field names in the spreadsheet, will it just be automatically omitted?
The only other thing I can think of would be to do one of the following:
- - a. save the workbook, b. delete the column in question, c. import the sheet, and c. close the workbook without saving
- - a. create a new sheet in the workbook, b. copy "impData" to the new sheet, c. Delete the column in question, d. name the range of data on the new sheet without the added column to "impDataReal", e. import "impDataReal", f. delete the added sheet.
- - build the impData range omitting the column. Something like:
Expand|Select|Wrap|Line Numbers- With xlSht
- strRng = .Range(xlSht.Cells(1, 1), xlSht.Cells(2, 1058)).Address & "," & .Range(xlSht.Cells(4, 1058)).Address
- End With
Methods 1 & 2 above seem kind of "clunky" to me. I was hoping someone out there had a better way! I'll have to try #3, but something tells me Access isn't going to like it.
Thanks in advance...