
You can get “file count in folder“!
VBA Code
As an example, get file count in “test” folder.


Option Explicit
Sub sample()
Dim targetFolder As String
Dim fso As Object
Dim fileCount As Long
targetFolder = "C:\Users\user\Desktop\test"
Set fso = CreateObject("Scripting.FileSystemObject")
'Get file count in folder
fileCount = fso.GetFolder(targetFolder).Files.Count
MsgBox ("file count : " & fileCount)
Set fso = Nothing
End Sub
Result
You got “file count in folder“!

FYI No.1
Also, you can get “folder count in folder“!
For more information, see the following article:
FYI No.2
For more information about following, see the following official online manual:
●“GetFolder method” of “FileSystemObject”
●“Files property” of “Folder Object”
●Files collection
●“Count property” of “collection”