Sub findfile(ByRef fd As Scripting.Folder, ByVal ct As Int16)
Dim sfd As Scripting.Folder
Dim f As Scripting.File
For Each f In fd.Files
TextBox1.Text = TextBox1.Text + Chr(13) + Chr(10) + Space(ct * 2) + f.Name
Next
For Each sfd In fd.SubFolders
TextBox1.Text = TextBox1.Text + Chr(13) + Chr(10) + Space(ct * 2) + "folder." + sfd.Name
findfile(sfd, ct + 1)
Next
End Sub
Dim sfd As Scripting.Folder
Dim f As Scripting.File
For Each f In fd.Files
TextBox1.Text = TextBox1.Text + Chr(13) + Chr(10) + Space(ct * 2) + f.Name
Next
For Each sfd In fd.SubFolders
TextBox1.Text = TextBox1.Text + Chr(13) + Chr(10) + Space(ct * 2) + "folder." + sfd.Name
findfile(sfd, ct + 1)
Next
End Sub