LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 434
Default 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.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listing Folder Contents into a Column LyndieBee Excel Worksheet Functions 1 August 29th 07 03:16 PM
Listing the contents of a folder [email protected] Excel Discussion (Misc queries) 2 April 12th 07 03:54 AM
Followup: Folder listing [email protected] Excel Discussion (Misc queries) 1 February 23rd 07 02:23 AM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
Periodically listing files in a folder haven104 Excel Discussion (Misc queries) 2 January 10th 06 09:01 AM


All times are GMT +1. The time now is 12:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"