Advertisement
Guest User

Untitled

a guest
Sep 12th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Globale Variable
  2.  
  3. Dim fldr As FileDialog
  4. 'Pfad suchen
  5. Function GetFolder() As String
  6.     Dim sItem As String
  7.     Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
  8.     With fldr
  9.         .Title = "Select a Folder"
  10.         .AllowMultiSelect = False
  11.         .InitialFileName = Application.DefaultFilePath
  12.         If .Show <> -1 Then GoTo NextCode
  13.         sItem = .SelectedItems(1)
  14.     End With
  15. NextCode:
  16.     GetFolder = sItem
  17.     Set fldr = Nothing
  18. End Function
  19.  
  20. Sub FindText()
  21. Dim i As Integer
  22. With Application.FileSearch
  23.     .LookIn = fldr  
  24.     .FileType = msoFileTypeAllFiles
  25.     .SearchSubFolders = False
  26.     .TextOrProperty = "_Applications" 'Such begriff
  27.    .Execute 'Suche Starten
  28.  
  29. 'Schleife für den names Print
  30.    For i = 1 To .FoundFiles.Count
  31.         MsgBox .FoundFiles(i)
  32.     Next i
  33.  
  34. End With
  35. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement