Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 141
  • Last Modified:

Application.FileSearch how to look in more than one folder

Part of my existing code is as follows:

With Application.FileSearch
        .NewSearch
        .FileName = "*.csv"
        .SearchSubFolders = False
        .LookIn = "S:\Folder1\Data
        .Execute

        etc, etc.


Question:    How would I set the above type of code up if I wanted to look in more folders, such as S:\Folder2\Data,
                  S:\Folder3\Data, etc, etc.
                  Do I have to re-code the above for each folder I want to look in?  Or can I list multiple folders on the
                  ".Lookin =" line?

I'm hoping for something like this:

With Application.FileSearch
        .NewSearch
        .FileName = "*.csv"
        .SearchSubFolders = False
        .LookIn = "S:\Folder1\Data, S:\Folder2\Data, S:\Folder3\Data   <----don't know how to code it but want to look
                                                                                                           in multiple folders here.
        .Execute

        etc, etc.




             
 
0
dbfromnewjersey
Asked:
dbfromnewjersey
1 Solution
 
Rey Obrero (Capricorn1)Commented:

change this

.SearchSubFolders = False

to

.SearchSubFolders = True
0
 
dbfromnewjerseyAuthor Commented:
Thanks!
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now