how to import multiple excel sheets into access

A

Amitabh Saraf

I have a large number of sheets in a single Excel workbook file. I can import
each sheet individually into an Access table using the import wizard of
Access. However the task is very time consuming. I was wondering if there
exists a
macro that can import all the worksheets from my workbook into Access with a
single command.

Thanks,

Amitabh
 
J

John Nurick

Hi Amitabh,

This can't be done with a macro; it takes VBA code. Dev Ashish MVP
posted the following in response to a similar question a few years ago:

----
You can set a reference to Excel library under Tools | References, and
then run through the sheets with Automation. (Air code)

Dim wkb as excel.Workbook
Dim sht as Excel.WorkSheet
Dim xl as Excel.Application
Set xl=new Excel.Application
xl.visible=true
Set Wkb=xl.Workbooks.Open("Something.xls")
With wkb
For Each sht in .Worksheets
Docmd.TransferSpreadsheet sht.name, <<...>>
Next
End With
----

If you go to http://groups.google.com and search for

aircode xlwb mysheetimport

you'll find a similar but less terse response.


On Mon, 27 Sep 2004 02:37:01 -0700, "Amitabh Saraf" <Amitabh
 

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