Folder listing
hi, Esra !
I want to get a folder listing (from a specific folder) that shows sub folders in the next column (under the parent folder)...
does a vba-macro serves well ?
Sub List_Subfolders()
Dim StartPath As String, FName As String, n As Integer
StartPath = Range("a1").Text
If Right(StartPath, 1) < "\" Then StartPath = StartPath & "\"
FName = Dir(StartPath & "*", vbDirectory)
Do While FName < ""
If (GetAttr(StartPath & FName) And vbDirectory) = vbDirectory Then _
If FName < "." And FName < ".." Then _
Range("b1").Offset(n) = FName: n = n + 1
FName = Dir()
Loop
End Sub
hth,
hector.
|