Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for both the suggestions - works a dream
"Chip Pearson" wrote in message ... Andy, In VBA, go to the Tools menu, choose References, and put a check next to Microsoft Scripting Runtime. Then, use the following code: Sub Start() Dim FSO As Scripting.FileSystemObject Dim Rng As Range Set FSO = New Scripting.FileSystemObject Set Rng = Range("A1") Const cSTART_FOLDER = "H:\ExcelProjects" '<<< CHANGE ListFiles FSO.GetFolder(cSTART_FOLDER), Rng End Sub Sub ListFiles(Fldr As Scripting.Folder, Rng As Range) Dim F As Scripting.File Dim FF As Scripting.Folder For Each F In Fldr.Files Rng.Value = F.Path Set Rng = Rng(2, 1) Next F For Each FF In Fldr.SubFolders ListFiles FF, Rng Next FF End Sub "Andibevan" wrote in message ... Hi All, I am trying to build a routine that will recursively search through all folders and subfolders for a given path and list all folders. I have found exmples of how to list all files but not only the folders. Any ideas? TIA Andy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I create folders in explorer from an excel list | Excel Discussion (Misc queries) | |||
Please help to list folders and subfolders tree in Excel or Word | Excel Discussion (Misc queries) | |||
Can anyone help me Create Excel list of files in windows folders | Excel Worksheet Functions | |||
Creating folders and subfolders from excel file list | Excel Discussion (Misc queries) | |||
Get folders list | Excel Programming |