Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would use application.filesearch in a excel macro
for searching the body text of PDF files, it works with office files but not with pdf. Any possible solution or alternatives to filesearch? Below my code Private Sub CommandButton1_Click() Dim files As Variant Dim name As Variant Set fs = CreateObject("Scripting.FileSystemObject") Cells.ClearContents With Application.FileSearch .NewSearch .LookIn = (UserForm1.TextBox1) .SearchSubFolders = True .TextOrProperty = (UserForm1.TextBox2) .FileType = msoFileTypeAllFiles If .Execute() 0 Then Cells(1, 1) = "There were " & .FoundFiles.Count & _ " file(s) found." For i = 1 To .FoundFiles.Count files = .FoundFiles(i) name = fs.getfilename(files) Cells(i + 2, 1).Hyperlinks.Add Anchor:=Cells(i + 2, 1), Address:=files, TextToDisplay:=name Next i Else Cells(1, 1) = "There were no files found." End If End With Thank you in advance |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.FileSearch | Excel Discussion (Misc queries) | |||
opening and searching files in filesearch | Excel Programming | |||
Set fs = Application.FileSearch | Excel Programming | |||
What is better: Application.FileSearch or Dir ?? | Excel Programming | |||
VBA Application.FileSearch | Excel Programming |