Function PrintFileTree(ByVal sFolder As String)
On Error Resume Next
' If you set a reference to Microsoft Scripting Runtime, you
' can use these declares and the following SET ...
'Dim fso As Scripting.FileSystemObject
'Dim fld As Scripting.Folder
'Dim fil As Scripting.File
'Set fso = New Scripting.FileSystemObject
' Otherwise, use late binding. This code will work without
' setting a reference to the library.
Dim fso, fld, fil
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(sFolder)
For Each fil In fld.Files
Debug.Print fil.Name
' you can also access modify date, size, etc.
Next
Set fld = nothing
Set fso = Nothing
End Function