Thread: Folder listing
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Esradekan Esradekan is offline
external usenet poster
 
Posts: 86
Default Folder listing

On Mar 30, 8:12*pm, "H ctor Miguel"
wrote:
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.


Hi Hector,

Thanks for the reply, but I'm not sure how to use this (adapt it for
my purposes). Where do I change this so I can insert the folder name
that will be my 'parent' folder?

Am I having a blonde moment?

Esra

TIA