Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get folders list
Hi, everybody!
Does anyone know, how to get a list of folders with all subfolders in Excel/VBA? I always get stuck when trying to write a code for that. Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get folders list
Eugene,
Set a reference (in VBA, Tools menu, References item) to Microsoft Scripting Library and use code like the following: Sub Start() Dim FSO As Scripting.FileSystemObject Dim TopFolder As Scripting.Folder Set FSO = New Scripting.FileSystemObject Set TopFolder = FSO.GetFolder("C:\Temp") DoOneFolder TopFolder End Sub Sub DoOneFolder(F As Scripting.Folder) Dim OneFolder As Scripting.Folder ' ' do something with F Debug.Print F.Path For Each OneFolder In F.SubFolders DoOneFolder OneFolder Next OneFolder End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Eugene" wrote in message ... Hi, everybody! Does anyone know, how to get a list of folders with all subfolders in Excel/VBA? I always get stuck when trying to write a code for that. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I create folders in explorer from an excel list | Excel Discussion (Misc queries) | |||
Create folders from list vb/macro? | Excel Discussion (Misc queries) | |||
macro to list folders only, not files | Excel Worksheet Functions | |||
List of folders in a certain directory | Excel Discussion (Misc queries) | |||
List folders to file | Excel Discussion (Misc queries) |