Import Excel Data into Access

  • Thread starter Thread starter sJ
  • Start date Start date
S

sJ

I have data in an excel workbook which in the same layout as my access
table. What is the easiest way to import it via VBA?

TIA
 
Via vba, you would use Docmd.actransferspreadsheet Acimport,, "your file name",
"C:\whatever" , true, "sheet1!A4:d10"
The true is if you have column headers you want to import with the document.
 
I have data in an excel workbook which in the same layout as my access
table. What is the easiest way to import it via VBA?

TIA

Easiest is to use the Access menu; select File... Get External Data... Import;
select .xls on the "files of type" dropdown, and then your workbook file.

TransferSpreadsheet does the same thing in VBA code and would be better for a
recurring task.
 
Back
Top