J
jenny
Hi,
When I tried to run a VB code to import 5 files into the access database, I
found that some the column headers are different from my Excel file. The
Excel headers doesn't contain '#' but the Access headers contains '#'. Even
more strange, it only happened to particular files, not all 5 files.
But when I tried to manually import using the wizard, I got no problems. Pls
help!!
The below is the code I used:
ImportSheet(1) = "A_R11"
ImportSheet(2) = "B_R11"
ImportSheet(3) = "C_R11"
ImportSheet(4) = "D_R11"
ImportSheet(5) = "E_R11"
With DoCmd
For Counter = 1 To 5
.DeleteObject acTable, ImportSheet(Counter)
.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
ImportSheet(Counter), FileName, -1, ImportSheet(Counter) &
"!A1:IV65536"
Next Counter
End With
When I tried to run a VB code to import 5 files into the access database, I
found that some the column headers are different from my Excel file. The
Excel headers doesn't contain '#' but the Access headers contains '#'. Even
more strange, it only happened to particular files, not all 5 files.
But when I tried to manually import using the wizard, I got no problems. Pls
help!!
The below is the code I used:
ImportSheet(1) = "A_R11"
ImportSheet(2) = "B_R11"
ImportSheet(3) = "C_R11"
ImportSheet(4) = "D_R11"
ImportSheet(5) = "E_R11"
With DoCmd
For Counter = 1 To 5
.DeleteObject acTable, ImportSheet(Counter)
.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
ImportSheet(Counter), FileName, -1, ImportSheet(Counter) &
"!A1:IV65536"
Next Counter
End With