ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   counting excel files (https://www.excelbanter.com/excel-programming/432362-counting-excel-files.html)

dstiefe

counting excel files
 
How do I count excel files that are not open

I want to put excel files in a folder ...then I want to first count the
number of files that are in the folder...

then open them

Thank you

Jacob Skaria

counting excel files
 
One way is to use DIR with a loop....

Sub Macro()
Dim strFolder As String, strFile As String
Dim intCount As Integer
strFolder = "d:\"
strFile = Dir(strFolder & "*.xls", vbNormal)
Do While strFile < ""
intCount = intCount + 1
strFile = Dir
Loop
MsgBox intCount & " files found"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"dstiefe" wrote:

How do I count excel files that are not open

I want to put excel files in a folder ...then I want to first count the
number of files that are in the folder...

then open them

Thank you



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

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