Property: SubFolders for Folder
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: SubFolders for Folder
Property: SubFolders for Folder
Returns the folders collection for a Folder object. You can use this to access the subfolders in a folder.
Set oFolders = Object.SubFolders
| Object | Folder Object with this property |
| oFolders | Folders Returned object |
The following example returns the number of folders:
Function CountFolders(sFolderSpec) Dim fso, oMyFolder, oMySubFolder, oMySubFolders Set fso = CreateObject("Scripting.FileSystemObject") Set oMyFolder = fso.GetFolder(sFolderSpec) Set oMySubFolders = oMyFolder.SubFolders CountFolders = "Number of folders: " & oMySubFolders.Count End Function