File count

  • Thread starter Thread starter Marijan Glavac
  • Start date Start date
M

Marijan Glavac

Hi,
I need to count all *.xls file in specific directory.
How to do it ?
Please help

Marijan
 
read HELP on the FileSearch object.
The following is copied almost exactly from the help. All I did was reverse
the examples & join them together...I remarked out stuff I didn't want. The
only real change that I made was the file type.


Sub FileList()

With Application.FileSearch
.NewSearch
.LookIn = "C:\My Documents"
.SearchSubFolders = True
''' .Filename = "Run"
''' .MatchTextExactly = True
.FileType = msoFileTypeExcelWorkbooks
'''End With
'''With Application.FileSearch
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
''' For i = 1 To .FoundFiles.Count
''' MsgBox .FoundFiles(i)
''' Next i
Else
MsgBox "There were no files found."
End If
End With




End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

File name 3
MS Office Project Manager 1
Files properties 2
Replaced text count 4
List Box and personal.xls 4
Active printer 1
Excel Count Formula in Excel 0
Count occurrences of filename in column 5

Back
Top