Import Excel Data into Access

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
 
G

golfinray

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.
 
J

John W. Vinson

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.
 
R

ryu

I have the same problem.

The line of code "Docmd.actransferspreadsheet Acimport,, "your fil
name",
"C:\whatever" , true, "sheet1!A4:d10" " should be written in the Acces
or Excel? If I were to write it in Excel VBA, how do I modify the code?

Thank you so much for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top