Property: Files for Folder
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: Files for Folder
Property: Files for Folder
Returns the file collection for a Folder object. You can use this to access the files in a folder.
The following example returns the number of files in a folder:
Function CountFiles(folderspec) Dim fso, oMyDrive, oMyFolder, oMyFiles Set fso = CreateObject("Scripting.FileSystemObject") Set oMyFolder = fso.GetFolder(folderspec) Set oMyFiles = oMyFolder.Files CountFiles = "Number of Files: " & oMyFiles.Count End Function