Hi
You could do something like the following.
Make a copy all the files you want to extract data from to a subfolder called Imports, which does not contain any other files.
then after you have completed all the work, delete all the files in that folder, so they cannot be imported a second time.
Then the frequency of running the code doesn't matter. If there is only 1 file in the folder, that's all that will be processed. If there are 10 there, then all 10 files will be processed.
Dim foundfiles as string, mypath as string
dim x as long
set mypath = ThisWorkbook.Path &"/Imports/"
foundfiles = Dir(MyPath & "*.xl*")
If foundfiles = "" Then
MsgBox "No Excel files in folder to Import"
Exit Sub
End If
x = 0
Do While FilesInPath <> ""
x = x + 1
ReDim Preserve MyFiles(1 To x)
MyFiles(x) = FilesInPath
FilesInPath = Dir()
Loop
'Do your stuff here to copy data in
MsgBox("All entries have been transfrerred into this file",vbInformation)
Kill mypath & "*.*"
Bookmarks