GEARZ.de

All snippets are without any warranty.
Alle Snippets sind ohne jegliche Gewähr oder Garantie.



walk through a given folder:   <back to snippets>

With Application.FileSearch
  .NewSearch
  .LookIn = strFolder
  If Range(<enterFieldForSwitchHere>) = True Then
    .SearchSubFolders = True
  Else
    .SearchSubFolders = False
  End If
  strFileExtension = "pdf"
  .Filename = "." & strFileExtension
  If .Execute > 0 Then
    For Each varFileName In .FoundFiles
      <DoSomeStuff>
    Next
  End If
End With