Hello,

The below script will open and save all Excel files in the "startdir", but now I am trying to move all of those modified files to the "enddir". I can not use "vaFileName" to move the files because it contains the whole path and file name. The whole point is to move all the modified files into a new directory (enddir) - I don't want a copy left in the "startdir". Any sugestions??


Option Explicit

Sub FindClientExcelFiles()
Dim FS As Office.FileSearch
Dim vaFileName As Variant
Dim startdir
Dim enddir
Dim Foo As Object
Dim iCount As Long

startdir = "C:\Temp\1"
enddir = "C:\Temp\2"

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)
Foo.Save
Foo.Close
'Foo.MoveFile startdir, enddir

Next vaFileName

End With

End Sub