Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import Workbook with multiple worksheets 1

Status
Not open for further replies.

sap1958

Technical User
Oct 22, 2009
138
US
Option Compare Database

Function TransferMultiples()
Dim strDir As String, strFile As String
strDir = "C:\pcsas_export_files\Test\"
strFile = Dir(strDir & "*.xls")
While strFile <> ""
DoCmd.TransferSpreadsheet acImport, 10, "invoiceg", strDir & strFile, True, ""
strFile = Dir
Wend
End Function

When I use the above named function it will import all workbooks into access. The issue is it will only import sheet1 of each workbook. Lets say I have the following workbook names and worksheets:
workbook1(sheet1,sheet2,sheet3)
workbook2(mysheet1,mysheet2,mysheet3)
How can I modify the code to import all worksheets into their own table names in access
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top