指定フォルダ内のサブフォルダを含めた全ファイル取得

Dim cnt As Long

Sub Sample3(Path As String)
Dim buf As String, f As Object
buf = Dir(Path & "\*.xls")
Do While buf <> ""
cnt = cnt + 1
Cells(cnt, 1) = Path & "\" & buf
buf = Dir()
Loop
With CreateObject("Scripting.FileSystemObject")
For Each f In .GetFolder(Path).SubFolders
Call Sample3(f.Path)
Next f
End With
End Sub

Sub Test()
cnt = 0
Call Sample3("C:\Users\naoki\Desktop\aaaa")
End Sub