473,395 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Import multiple Excel files into Access

......how do I select multiple Excel files to import into Access?
Any insights would be deeply appreciated.
May 3 '07 #1
3 7716
MMcCarthy
14,534 Expert Mod 8TB
......how do I select multiple Excel files to import into Access?
Any insights would be deeply appreciated.
Are all these files being imported into separate tables or the one table?
May 4 '07 #2
Are all these files being imported into separate tables or the one table?
Moving them all into one table would be preferable; each source file is approx. 300 rows and contains data on a monthly basis from January, '95 to Current. I hope I'm telling you enough to answer the question.
May 4 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Try something like this ...

Expand|Select|Wrap|Line Numbers
  1. Dim strFile As String 'Filename
  2. Dim strFileList() As String 'File Array
  3. Dim intFile As Integer 'File Number
  4. Dim path As String
  5. Dim filename As String
  6. Dim strSQL As String
  7.  
  8.     path = "path to your folder containing the files"
  9.     Set db = CurrentDb
  10.     DoCmd.SetWarnings False
  11.  
  12.     'Loop through the folder & build file list
  13.     strFile = Dir(path & "*.xls")
  14.     While strFile <> ""
  15.          'add files to the list
  16.         intFile = intFile + 1
  17.         ReDim Preserve strFileList(1 To intFile)
  18.         strFileList(intFile) = strFile
  19.         strFile = Dir()
  20.     Wend
  21.      'see if any files were found
  22.     If intFile = 0 Then
  23.         MsgBox "No files found"
  24.         Exit Sub
  25.     End If
  26.  
  27.     'cycle through the list of files
  28.     For intFile = 1 To UBound(strFileList)
  29.        filename = path & strFileList(intFile)
  30.        DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel3, "TableName", filename, True 'replace TableName with your table name
  31.  
  32.     Next intFile
Mary
May 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook -...
2
by: amy | last post by:
Hi, all: i am a new end user of access, now I have many excel files need to import to One table in access (combine all excel files into one table in excel). In excel files, some columns will have...
11
by: MD | last post by:
Hello, I need to import a sheet of 884 different excel-file with same lay- out. The sheet name is 'Totaal' and is the same in all different files. Is there a script (module) in order to: 1....
3
by: MarcGA | last post by:
(Excel 2003, Access 2003, XP, novice user here) I can't get Access to accept multiple Excel files to the same table. I can import the spreadsheets to a new table, but I need to import 23...
8
by: shenkel55 | last post by:
I'm using Access and Excel 2003. Using either the import wizard or code, I have the same problem. This problem only happens with Excel files automatically generated by Corp IT. If I try to do an...
5
by: hushens10 | last post by:
Access Naive - Help Needed I am using Access 2003 and Excel 2003. My goal is to create a database for a school where each student's testing information can be stored and organized so that it can...
7
by: ivancycheng | last post by:
I have around 400 excel files with same format (multiple sheets) and wants to import few sheets from excel to MS Access (XP version) for further processing. any one can advise me how to do it? (I'm...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
2
by: BlackEyedPea | last post by:
Hi I have no coding experience but am using access 2003 on XP in the hope that I can find some code that will.... Search a folder in my network & import any excel spreadsheets it finds within...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.