View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Satish Satish is offline
external usenet poster
 
Posts: 37
Default How to List the names of the subfolders present in the folder (path of folder is given in the textbox by user )

Divya:

I have used the shell command to get the list of folders...
e.g:

dim z as string
dim x as variant

z = "dir c:\mydir /a:d /b /sdirs.txt"
x = shell(z)

that gives me all the subfolders from c:\mydir in the text file
dirs.txt along with the entire path. (This text file is created under
c:\mydir)

Another cool way to do it is :
http://www.thescripts.com/forum/thread459690.html

refer to the second-last post on this thread...that also does it.

It uses the Dir function of VB recursively.

HTH
-Satish

divya wrote:
Can any body help me with the code to find the names of the subfolders
present in the Folder whose path the user enters in the textbox.
When the user enters the path in the textbox , I want to display in a
LIST BOX the names of all the subfolders present in that folder . File
search returns the names of files in tht folder .. How do I get the
names of the sub folders in that folder?? Please let me know...

Cheers!!!
Divya