bugsie857
11-13-2012, 03:59 AM
Hi all, I am a newbie to VBA and have just completed my first automated task, but I want more!
I have several xls files in a set folder that I import into Access. The code I use is below. The issue I have is that the folder will change, so I need to be able to add a "choose folder" dialoge box. Also the code below asks me to type in a persons name to import that person's xls... I would rather it just import every xls file in the selected folder.
The name of the database table is "Import_Data".
Each xls file to be imported has several tabs with a named region "Import_Data"
I hope this makes sense.
Any ideas?!
Andrew
****************************
Private Sub ORA_Import_Click()
Dim FileName As String
FileName = InputBox("Enter Name")
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Import_Data", "K:\SSED\14 - 19\14-19\Common to All\Data\1 Data Sources\Providers\Wentworth Apr122\ROA\" & FileName & "", True, "Export_Data"
End Sub
I have several xls files in a set folder that I import into Access. The code I use is below. The issue I have is that the folder will change, so I need to be able to add a "choose folder" dialoge box. Also the code below asks me to type in a persons name to import that person's xls... I would rather it just import every xls file in the selected folder.
The name of the database table is "Import_Data".
Each xls file to be imported has several tabs with a named region "Import_Data"
I hope this makes sense.
Any ideas?!
Andrew
****************************
Private Sub ORA_Import_Click()
Dim FileName As String
FileName = InputBox("Enter Name")
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Import_Data", "K:\SSED\14 - 19\14-19\Common to All\Data\1 Data Sources\Providers\Wentworth Apr122\ROA\" & FileName & "", True, "Export_Data"
End Sub