View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
divya divya is offline
external usenet poster
 
Posts: 26
Default How to List the names of the subfolders present in the folder (pat

Thanks a lot stefi and Satish for the quick reply.
Stefi wrote:
See Excel Help for Dir Function example! You'll find there the very answre to
your question!

' Display the names in C:\ that represent directories.
MyPath = "c:\" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
Do While MyName < "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If MyName < "." And MyName < ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
Debug.Print MyName ' Display entry only if it
End If ' it represents a directory.
End If
MyName = Dir ' Get next entry.
Loop

Regards,
Stefi

,,divya" ezt írta:

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