Property: Count for Folders
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: Count for Folders
Property: Count for Folders
Returns the number of folders.
Object.Count
| Object | Folders Object with this property |
| Object.Count | LongInteger with read access |
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