Ooops!
I think I mixed up my < and > signs. Try the following, I've added a few debug.print lines so you can see what's happening in the Immediate window.
Debug.Print Now() - 5 / (24 * 60)
For Each vaFileName In .FoundFiles
Debug.Print FileDateTime(vaFileName)
If FileDateTime(vaFileName) < Now() - 5 / (24 * 60) Then
Debug.Print vaFileName & " - True"
Set Foo = Workbooks.Open(vaFileName)
Application.DisplayAlerts = False
Foo.SaveAs enddir & Foo.Name
Debug.Print enddir & Foo.Name
Foo.Close
Application.DisplayAlerts = True
Kill vaFileName
Else
Debug.Print vaFileName & " - False"
End If
Next vaFileName
The following variation with attached function should let you accomplish the same task without opening the files.
For Each vaFileName In .FoundFiles
If FileDateTime(vaFileName) < Now() - 5 / (24 * 60) Then
MyFile = FName(vaFileName)
Source = startdir & "\" & MyFile
Dest = enddir & MyFile
FileCopy Source, Dest
Kill Source
End If
Next vaFileName
End With
End Sub
Function FName(FileName)
j = Len(FileName)
For i = j To 1 Step -1
If Mid(FileName, i, 1) = "\" Then
FName = Right(FileName, j - i)
Exit For
End If
Next
End Function