View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
crazybass2 crazybass2 is offline
external usenet poster
 
Posts: 167
Default Search a text file for a string

As usual, it's not until after you post your question that you stumble onto
the solution...


With Application.FileSearch
.NewSearch
.LookIn = Filename
.SearchSubFolders = True
.TextOrProperty = "NODE DATA"
.FileType = msoFileTypeAllFiles
If .Execute 0 Then
...some code
End if
End With


"crazybass2" wrote:

I want to search a given text file for a certain string. Is this possible?
If so, how would I code it?

The file path and name is stored in the variable Filename. The search text
is "NODE DATA" I just want excel to search the file given and return a
boolean (True/False) as to whether the string exists in the text file.

All help is appreciated.

Thanks.