Determine if folder exists

T

Terry K

Hello all,
Hoping that there might be some ideas out there to assist me in working
out this little problem. I have a spreadsheet with several columns in
it. One of the columns contains names of what MIGHT be file names
located in a particular directory. Is there any way to walk a directory
based on a preset starting point and determine if the value of a cell
exists as a folder?
IE: a1 = "My_File". Starting point could be my documents. Every folder
under my documents would be compared agaist "My_File" if a match was
found it would return "found" if it reached the end of the structure
after looking at each folder and subfolder and could not find it it
would return "not found". For my purposes I do not need to worry about
possibly finding "My_File" more than once. If I find it once the code
should stop execution.
Any suggestions or just a good solid starting point would be greatly
appreciated.
Thanks Terry
 
G

Guest

It can get involved, to get you started:

Dim FSO As New FileSystemObject
Dim SubFolder As Folder

For Each SubFolder In FSO.GetFolder("C:\").SubFolders
Debug.Print SubFolder.Name
Next SubFolder
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top