Is there a way to set the LastModified to minutes?? So I only open files that were modified 5 minutes or more ago??


Sub FindClientExcelFiles()
  Dim FS As Office.FileSearch
  Dim vaFileName As Variant
  Dim startdir
  Dim enddir
  Dim Foo As Object
  Dim iCount As Long
  Dim newname As Variant
  Dim fsoObj As Object, TheDate As String
TheDate = Format(Date, "YYYYMMDD")
startdir = "C:\Temp\1"
  enddir = ("C:\Temp\" & TheDate & "\")
Set fsoObj = CreateObject("Scripting.FileSystemObject")
    With fsoObj
    If Not .FolderExists(enddir) Then
        .CreateFolder (enddir)
    End If
End With
  Set FS = Application.FileSearch
  With FS
    'Clear old search criteria
    .NewSearch
    'Directory to search
    .LookIn = startdir
    'Include sub folders in search
    .SearchSubFolders = True
    'Look for Excel files
    .FileType = msoFileTypeExcelWorkbooks
    'Doesn't matter when last modified
    .LastModified = msoLastModifiedAnyTime
    iCount = .Execute
    'List the files in the FoundFiles collection
    For Each vaFileName In .FoundFiles
Set Foo = Workbooks.Open(vaFileName)
    Application.DisplayAlerts = False
    Foo.SaveAs enddir & Foo.Name
    Foo.Close
    Application.DisplayAlerts = True
    Kill vaFileName
Next vaFileName
  End With
End Sub