Option Explicit
'FileSystemObject必须在"工程、引用"中选中Microsoft Scripting Runtime
Public fso As New FileSystemObject
Sub MyProc1(ByVal Folder As String)
Dim objFile, objFolder
Set objFolder = fso.GetFolder(Folder)
For Each objFile In objFolder.Files
MyProc2 objFile.Path
Next
For Each objFolder In objFolder.SubFolders
MyProc1 objFolder '递归遍历整颗树
Next
End Sub
Sub MyProc2(FileName As String)
Debug.Print FileName
End Sub