O
OP
Hi there,
I guess the subject has already been raised a thousand times, but I am
at lost wirth my macro. Of course everything worked well with Excel
2003; but as Filesearch has been removed from 2010 I can't really find a
clue to solve my problem. I looked over a couple of forums for a
filescript substitute but found nothing simple enough for me to
understand.
Here is my problem :
I have variables, (Fpath and Fname) that I run through the Filesearch
funtion. That returns me a single filename (Fil) that I use to copy to a
another folder... See the code below.
Would appreciate if anybody could help me to master this under 2010.
Thanks
With Application.FileSearch
..NewSearch
..LookIn = FPath
..SearchSubFolders = True
..Filename = fName
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
Fil = .FoundFiles(1)
Else
MsgBox "There were no files found."
Exit Sub
End If
End With
FileCopy Fil, dest + fName
I guess the subject has already been raised a thousand times, but I am
at lost wirth my macro. Of course everything worked well with Excel
2003; but as Filesearch has been removed from 2010 I can't really find a
clue to solve my problem. I looked over a couple of forums for a
filescript substitute but found nothing simple enough for me to
understand.
Here is my problem :
I have variables, (Fpath and Fname) that I run through the Filesearch
funtion. That returns me a single filename (Fil) that I use to copy to a
another folder... See the code below.
Would appreciate if anybody could help me to master this under 2010.
Thanks
With Application.FileSearch
..NewSearch
..LookIn = FPath
..SearchSubFolders = True
..Filename = fName
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
Fil = .FoundFiles(1)
Else
MsgBox "There were no files found."
Exit Sub
End If
End With
FileCopy Fil, dest + fName