View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Extract folder names only

Sub FolderList()
Dim iFolder As Long
Dim oFSO As Object
Dim oFolder As Object
Dim oFldr As Object

Set oFSO = CreateObject("Scripting.FileSystemobject")
Set oFolder = oFSO.getfolder("C:\Data")

For Each oFldr In oFolder.subfolders
iFolder = iFolder + 1
Cells(iFolder, "A").Value = oFldr.Name
Next oFldr

Set oFolder = Nothing
Set oFSO = Nothing

End Sub

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Michael Singmin" wrote in message
...
Hello group,

I am using Application.FileSearch
I don't want to extract any files, only the folder names.

I am assembling a fine art project with jpg images.
I have approximately 500 artists spread over 11 art movements.
Each artist has its own folder and the folder name displays his name,
birthdate and death date. I want to extract these folder names into a
worksheet.

Can FileSearch be used for my application ?

Thanks,

Michael Singmin