This little macro should help you out, it will locate the oldest file in a folder and return the file name, in this case just to a msgbox, but im sure you could use that as you need.
please let me know if you need any help
Sub FindNewFile()
Dim OldestFileDate As Date
Dim OldestFileName, MyPath, CurrentFileName As String
MyPath = "C:\TestFolder\"
If Right(MyPath, 1) <> "\" Then MyPath = MyPath & "\"
CurrentFileName = Dir(MyPath & "*.csv")
Do
If FileDateTime(MyPath & CurrentFileName) > OldestFileDate Then
OldestFileName = MyPath & CurrentFileName
OldestFileDate = FileDateTime(MyPath & CurrentFileName)
End If
CurrentFileName = Dir()
Loop While CurrentFileName <> ""
MsgBox (OldestFileName)
End Sub
Bookmarks