Sub MostRecentFile(dir As String) As String
Dim latest As String
Dim t As Long = 0
For Each f As String In File.ListFiles(dir)
If Not(File.IsDirectory(dir,f)) Then
If File.LastModified(dir,f)>t Then
latest = f
t = File.LastModified(dir,f)
End If
End If
Next
Return latest
End Sub