Collection: Folders
- Updated2024-09-12
- 1 minute(s) read
(Collections | FileSystemObject) > Collection: Folders
Collection: Folders
Collection of all Folder objects. You can use the Folder collection to count folders or to access individual folders.
The following example generates a collection of all folders and subfolders:
Function CreateFolderList(sFolder) Dim fso, oMyFolder, oMySubFolder, oMySubFolders, sOutput Set fso = CreateObject("Scripting.FileSystemObject") Set oMyFolder = fso.GetFolder(sFolder) Set oMySubFolders = oMyFolder.SubFolders For Each oMySubFolder in oMySubFolders sOutput = sOutput & oMySubFolder.Path & VbCrLf sOutput = sOutput & CreateFolderList(oMySubFolder.Path) Next CreateFolderList = sOutput End Function
Methods
Returned From
See Also