OR via VBScript
[vb]
Option Explicit
Function CountOfFiles(strFolderPath As String) As Double
Dim objFso As Object
Dim objFolder As Object
Set objFso = CreateObject("Scripting.FileSystemObject"

Set objFolder = objFso.GetFolder(strFolderPath)
CountOfFiles = objFolder.Files.Count
End Function
Sub Tester()
MsgBox CountOfFiles("C:\ExcelFiles\Useful\"

End Sub
[/vb]
Or using WMI
[vb]
Sub CountFilesInFolder()
'// Enumerate All the Files in a Folder
'// Description
'// Returns a count of all the files in the Scripts folder.
'// (for example, C:\Scripts and D:\Scripts), files will be returned from each of these folders.
Const LookinDir = "AAddin_WIP"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"

Set colFiles = objWMIService.ExecQuery("Select * from CIM_DataFile where Path = '\\" & LookinDir & "\\'"

'//
MsgBox colFiles.Count
End Sub
[/vb]
Ivan F Moala