PDA

View Full Version : Find all xls files except one subfolder



starsky
09-23-2009, 04:02 AM
Hi,

I've a macro that will look through all subfolders in a parent folder, and copy all xls files to another destination. However, I want to exclude one subfolder from that search (an archive that doesn't need to be copied). How can I adapt the following piece of code to do this?


With Application.FileSearch
.NewSearch

'Change path to suit
.LookIn = C:\ParentFolder\"
.SearchSubFolders = True
.FileType = msoFileTypeExcelWorkbooks


Many thanks.

Bob Phillips
09-23-2009, 04:07 AM
Why not just do as you are at present, then do a find on all files in that one directory and delete (kill) them from your new directory?

starsky
09-23-2009, 04:22 AM
I'd have to pick them out from hundreds, plus I'd be copying far more then I need to in the first place.

Bob Phillips
09-23-2009, 04:40 AM
No, get the code to do it.