View Full Version : import Directory Folder list


snadyau
11-27-2007, 01:29 AM
I want to create a VBA script that will allow me to nominate a Directory Tree and import to a table all the names of the folders in that tree. I thought application.filesearch might do it but I can only see how to work with filenames - not folder names. I am not interested in file names (though how many files in each folder may be useful) Any suggestions?

Also I find it confusing as to the correct way to use .filesearch and would appreciate a pointer to where I can find the right help (VBA help is a bit brief on this issue)

TIA

aikea
11-27-2007, 01:47 AM
There is code example in msdn.com. If shows you how to check whether a file or folder exist, list files in a particular folder etc.

Go to msdn.com then "VBA Dir()"

snadyau
11-27-2007, 02:08 AM
Thanks for your response - but I think I got side tracked into something else. searching the web site msdn.com for "VBA Dir()" produced the following

Dir()
Returns or sets a String that represents the reading order of text in an HTML element.

expression.dir
expression Required. An expression that returns one of the objects in the Applies To list.

For me this does not relate to the question. Or am I missing something

TIA
Sandy

aikea
11-27-2007, 02:22 AM
Here:

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarofftalk/html/office09072000.asp

snadyau
11-27-2007, 03:13 AM
Thanks - I didn't think of using those commands directly. how daft of me. A few loops and I think it can be done.

Again - thanks
Sandy