Note: But you can also read the output from Dir directly as a string if you don't want to use a file.
Base on #5:
Base on #5:
Code:
Dim StdOut As String
Dim Files() As String
With CreateObject("WScript.Shell")
StdOut = .Exec("cmd.exe /c dir """ & StartDirectory & "\*." & FileExtension & """ /b /s").StdOut.ReadAll
End With
If Right(StdOut, Len(vbNewLine)) = vbNewLine Then
StdOut = Left(StdOut, Len(StdOut) - Len(vbNewLine))
End If
Debug.Print ">" & StdOut & "<"
Files = Split(StdOut, vbNewLine)
Debug.Print UBound(Files) + 1