Solved

Application.FileSearch how to look in more than one folder

Posted on 2006-11-17
2
132 Views
Last Modified: 2008-02-01
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
Comment
Question by:dbfromnewjersey
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 125 total points
ID: 17968471

change this

.SearchSubFolders = False

to

.SearchSubFolders = True
0
 

Author Comment

by:dbfromnewjersey
ID: 18030435
Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now