ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count number of files in a folder (https://www.excelbanter.com/excel-programming/375011-count-number-files-folder.html)

CAM

Count number of files in a folder
 
Hello,

I am using Excel 2003 and I like to make a macro that will count the number
of Excel files and displays the number in Excel from a particular folder
before I print all the files from the folder. Another words if there is 10
files in folder "Test" I like to show that number in Excel. How do I do
that. Any website to visit or help will be appreciated. Thank you in
advance.



Bob Phillips

Count number of files in a folder
 
Dim FSO As Object

Set FSO = CreateObject("Scripting.FileSystemObject")
Debug.Print FSO.GetFolder("C:\Test").Files.Count

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"CAM" wrote in message
...
Hello,

I am using Excel 2003 and I like to make a macro that will count the

number
of Excel files and displays the number in Excel from a particular folder
before I print all the files from the folder. Another words if there is 10
files in folder "Test" I like to show that number in Excel. How do I do
that. Any website to visit or help will be appreciated. Thank you in
advance.





CAM

Count number of files in a folder
 
Thanks Bob,

I will give it a shot.


"Bob Phillips" wrote in message
...
Dim FSO As Object

Set FSO = CreateObject("Scripting.FileSystemObject")
Debug.Print FSO.GetFolder("C:\Test").Files.Count

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"CAM" wrote in message
...
Hello,

I am using Excel 2003 and I like to make a macro that will count the

number
of Excel files and displays the number in Excel from a particular folder
before I print all the files from the folder. Another words if there is
10
files in folder "Test" I like to show that number in Excel. How do I do
that. Any website to visit or help will be appreciated. Thank you in
advance.








All times are GMT +1. The time now is 02:17 PM.

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