Sub FileListDemo() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\")
For Each objFile In objFolder.Files
Debug.Print objFile.name
Next objFile