Runawaygeek
Registered User.
- Local time
- Today, 04:56
- Joined
- Mar 28, 2016
- Messages
- 77
Hi all,
I know this subject has been covered and i have been reading a lot of those posts, but i cant find/get to work exactly what i am looking for.
I have a folder location that will get 6 new Excel files added to it each day, with names that mean nothing most of the time.
But the structure of all the files will be the same.
I wish to have a button on a form that will collect these 6 files and import them all onto the same table.
my current code looks like:
I get no errors, just nothing happens??
After Import the 6 files will be removed from the folder.
Any help would be great,
thanks,
I know this subject has been covered and i have been reading a lot of those posts, but i cant find/get to work exactly what i am looking for.
I have a folder location that will get 6 new Excel files added to it each day, with names that mean nothing most of the time.
But the structure of all the files will be the same.
I wish to have a button on a form that will collect these 6 files and import them all onto the same table.
my current code looks like:
Code:
Private Sub Button_Import()
Call Import_Excel
End Sub
Function Import_Excel()
Dim myfile
Dim mypath
mypath = "C:\Folder\Input"
ChDir(MyPath)
myfile = Dir("C:\Folder\Input")
Do While myfile <> ""
If myfile Like "*.xlsx" THEN
DoCmd.TransferSpreadsheet acImport, , "Excel_Import", mypath & myfile
End If
myfile = Dir("C:\Folder\Input")
Loop
End Function
I get no errors, just nothing happens??
After Import the 6 files will be removed from the folder.
Any help would be great,
thanks,