View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mishell[_3_] Mishell[_3_] is offline
external usenet poster
 
Posts: 22
Default search text files for a certain word

f = "c:\test.txt"
filenumber = FreeFile
Open f For Input As filenumber
a = Input(FileLen(f), filenumber)
Close filenumber

LookFor = LCase("SerialNo")
b = InStr(LCase(a), LookFor)
If b 0 Then
MsgBox Mid(a, b + Len(LookFor), 10)
End If

Mishell


"Fan924" a écrit dans le message de news:
...
How do I search text files for a certain word using a macro. I need to
look for the word "SerialNo" and return the following 10 characters. I
will be repeating this for hundreds of files. For now, how do I do it
for a single file. Excel 97