files.
The following should work on any Office files, but I don't think it will
find anything in a PDF. Most PDF viewers have their own search capabilities.
Function TextSearch()
' Search for text in a file
' Note: Must set a reference to Microsoft Office 8.0 Object Library
Dim q As Long
With Application.FileSearch
.NewSearch
.LookIn = "C:\" 'Path
.SearchSubFolders = True
.FileName = "*.*"
.TextOrProperty = "Word1 Word2 Word3 Word4" 'Search words
If .Execute() > 0 Then
For q = 1 To .FoundFiles.Count
MsgBox .FoundFiles(q)
Next
End If
End With
End Function
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com