It works right with single folders but if the treee level is higher than 2, the error increases with the length of he tree.
I am trying to get quantity of xl in a folde including subfolders in order to create an array.
(I will use open all files within another sub and create a report)
Any ideas?
Private Sub Countfiles(FF As Scripting.Folder)
Dim F As Scripting.file
Dim SubF As Scripting.Folder
Dim k As Integer
For Each F In FF.Files
If F.Path Like "*.xl*" Then
k = k + 1
Debug.Print r_tot + k
Else
End If
Next
For Each SubF In FF.Subfolders
r_tot = r_tot + k
Countfiles SubF
Next SubF
End Sub