Option Explicit
Const iArrayIncrement% = 100
Dim objFS As Object, ayFiles(), i%
Sub ListFileVoudou()
Dim strFolder$, rngOutput As Range
'PICK WHERE YOU WANT TO START. THIS MACRO WRITES A LIST TO A SREADSHEET
strFolder = "C:\Users\skippy\Documents\"
Set rngOutput = ActiveWorkbook.ActiveSheet.Range("A1")
Set objFS = CreateObject("Scripting.FileSystemObject")
ReDim ayFiles(1 To 3, 1 To iArrayIncrement)
i = 0
'LOOK THRU ALL FOLDER AND SUBFOLDERS
psListIndividualFiles strFolder
ReDim Preserve ayFiles(1 To 3, 1 To i)
rngOutput.Resize(rowsize:=i, columnsize:=3) = Application.Transpose(ayFiles)
Debug.Print "Finished: " & i & " files"
Set rngOutput = Nothing
Set objFS = Nothing
Beep
End Sub
Private Sub psListIndividualFiles(ByVal strFolder$)
Dim oFile As Object, tmpName$, tmpExt%, oSubFldr As Object
For Each oFile In objFS.GetFolder(strFolder).Files
'DO STUFF WITH YOUR FILES IN HERE THIS GETS FILE NAMES TO PRINT LATER
i = i + 1
If i > UBound(ayFiles, 2) Then ReDim Preserve ayFiles(1 To 3, 1 To (UBound(ayFiles, 2) + iArrayIncrement))
ayFiles(1, i) = strFolder
tmpName = oFile.Name
ayFiles(2, i) = tmpName
tmpExt = InStrRev(tmpName, ".")
If tmpExt > 0 Then ayFiles(3, i) = Mid(tmpName, tmpExt, 5)
Next oFile
For Each oSubFldr In objFS.GetFolder(strFolder).SubFolders
psListIndividualFiles strFolder & "\" & oSubFldr.Name
Next
End Sub