Import from named ranges in Excel workbook into Access and append to tables


I would be grateful if you could you please explain what VBA script I could use to import data from named ranges in an Excel workbook and append to existing tables in an Access database.  Each range in the Excel workbook would correspond to a table in Access.

I would need to perform this import on several Excel workbooks which would have different filenames.

Thank you
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
you can use this command line

docmd.transferspreadsheet acimport,8,"Nameoftable","c:\folder\myXl.xls",true,"NameOfRange"
Helen FeddemaCommented:
Or the longer (but more comprehensible) named argument syntax:

DoCmd.TransferSpreadsheet transfertype:=acImport, _
   spreadsheettype:=acSpreadsheetTypeExcel9, _
   tablename:=strTable, _
   FileName:=strWorkbook, _ 
   hasfieldnames:=True, _

Open in new window

For the spreadsheettype value, here is a list from the Help topic:

Spreadsheettype values enum
The Help topic is a little out of date; there is also a new value for Office 2010, acSpreadsheetTypeExcel12Xml (Excel 2010 workbook).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alisonthomAuthor Commented:
Thank you very much for the quick and detailed response!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.