View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bruno Campanini[_3_] Bruno Campanini[_3_] is offline
external usenet poster
 
Posts: 52
Default .Foundfiles Question

"Shane" wrote in message
...

Would you be able to advise how I could copy the files found by the
following macro to a another directory - say D:\Data

[...]

Simply replace your IF clause with the following:
====================================
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) Then
For i = 1 To .FoundFiles.Count
FileCopy .FoundFiles(i), "C:\Prova\" & _
Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1)
Next i
Else
MsgBox "There were no files found."
End If
====================================
Ciao
Bruno