Obtain Sub-Folder Names with VBA?

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

Is it possible to obtain the names of all Sub-Folders for a specific parent
Folder?

Just 2 levels (1 Parent Folder) and several children folders.

We need the names of the sub-folders, not the names of the files in the
sub-folders.

Thanks for your help.
Brad
 
Brad said:
Is it possible to obtain the names of all Sub-Folders for a specific
parent
Folder?

Just 2 levels (1 Parent Folder) and several children folders.

We need the names of the sub-folders, not the names of the files in the
sub-folders.

Thanks for your help.
Brad

Try this:

http://www.smccall.demon.co.uk/Downloads.htm#FsRecurse

Store the folder names as they are discovered, in the FolderFound event,
into a collection, table, etc.
 
Use Dir to list the files that have the vbDirectory attribute set, adn then
GetAttr() to test if it is a folder. The FileExists() and FolderExists()
functions here illustrate using those functions:
http://allenbrowne.com/func-11.html

This code lists files in a folder and its subfolders recursively:
http://allenbrowne.com/ser-59.html
Use that approach if you need to go down the tree further (i.e. the
sub-subfolders below that etc.)
 
Allen, Daniel, Stuart,

Thanks to all of you for the ideas/help.

You guys are great!

I have it working already with your help.

Brad
 
Back
Top