List all files under application path : File « File Path « VBA / Excel / Access / Word






List all files under application path

 

Sub FileList()
  Dim File As Variant
  With Application.FileSearch
    .LookIn = "C:\"
    .FileType = msoFileTypeAllFiles
    .Execute
    For Each File In .FoundFiles
      MsgBox File
    Next File
  End With
End Sub

 








Related examples in the same category

1.Does the specified file exist?
2.Check file existance
3.Gets the file name from the path.
4.Select a folder
5.Select a location containing the files you want to list
6.processes multiple stored files
7.Common File Operations Simplified
8.Use array to store a list of files