ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Counting the Number of Folders Not Files. (https://www.excelbanter.com/excel-programming/275657-counting-number-folders-not-files.html)

Ron[_8_]

Counting the Number of Folders Not Files.
 
I can count the number of files in a directory by using
foundfiles.count property, but what would I use to count
the number of folders(directories)?

Bob Phillips[_5_]

Counting the Number of Folders Not Files.
 
or without the reference

MsgBox
CreateObject("Scripting.FileSystemObject").GetFold er("C:\Temp").SubFolders.C
ount

--

HTH

Bob Phillips

"Chip Pearson" wrote in message
...
Ron,

Set a reference to the Windows Scripting Runtime library and use code such
as the following:

Dim FSO As New Scripting.FileSystemObject
MsgBox FSO.GetFolder("C:\Temp").SubFolders.Count


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Ron" wrote in message
...
I can count the number of files in a directory by using
foundfiles.count property, but what would I use to count
the number of folders(directories)?







All times are GMT +1. The time now is 12:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com