I know Excel 2007 no longer has the Application.FileSearch available. I'm confused looking at different posts on how to fix it. I just want to open the last file modified in a certain directory. Here's how it looked for MS Excel 2003:
With Application.FileSearch
.LookIn = "U:\Daily Files\"
.Filename = "*.xls"
If .Execute(msoSortByLastModified, msoSortOrderDescending) > 0 Then
Workbooks.Open .FoundFiles(1), ReadOnly:=True
Else
MsgBox "There were no files found."
End If
End With
How do I get this to work in 2007?
With Application.FileSearch
.LookIn = "U:\Daily Files\"
.Filename = "*.xls"
If .Execute(msoSortByLastModified, msoSortOrderDescending) > 0 Then
Workbooks.Open .FoundFiles(1), ReadOnly:=True
Else
MsgBox "There were no files found."
End If
End With
How do I get this to work in 2007?