Sue,
Try this.
Change
..Lookin = "C:\" to whatever the path to the folder is.
Change "Default Folder Name Here" to whatever folder you wish as default.
Entering the "*" as file extension in the second Input Box
will count all files, otherwise just the extension entered in the box
will be counted.
Public Sub CountFiles()
Dim fs As Object
Set fs = Application.FileSearch
With fs
.Lookin = "C:\" & InputBox("Enter Folder Name", "Folder?", "Default
Folder Name Here")
.FileName = InputBox("FileType", "*.doc, *.mdb, *.xls, *.txt, "*")
' (SortOrder:=1)ASCENDING (=2)DESCENDING
If .Execute(SortOrder:=1) > 0 Then
MsgBox "There were " & .FoundFiles.count & _
" file(s) found."
Else
MsgBox "There were no files found."
End If
End With
Set fs = Nothing
End Sub
--
Fred
Please reply only to this newsgroup.
I do not reply to personal e-mail.
"Sue" <sm********@earthlik.net> wrote in message
news:jj******************@newsread1.news.atl.earth link.net...
How can I count the number of files in a folder?
Thanks for all help!!
Sue