BrewGuru99
October 21st, 1999, 12:31 PM
Okay, I have a text file that I'm doing a InStr search through for a word. When I find that word, I want to return the line that the word is on.
Example:
Dim Str1 as string, Pointer as Long
'set string (this is basically what it will be like.)
Str1 = _
"Blah blah blah" & vbcrlf & _
"Hooo Haa Hee ha" & vbcrlf & _
"My search will find a word in this line." & vbcrlf & _
"more text........" & vbcrlf
'Find the word
Pointer = InStr(Str1, "in")
If Pointer > 0 then
....
'Return the "line" of text. In this instance, it would return:
'"My search will find a word in this line."
....
I don't need the vbcrlf, but i can filter that out after the fact.
Brewguru99
Example:
Dim Str1 as string, Pointer as Long
'set string (this is basically what it will be like.)
Str1 = _
"Blah blah blah" & vbcrlf & _
"Hooo Haa Hee ha" & vbcrlf & _
"My search will find a word in this line." & vbcrlf & _
"more text........" & vbcrlf
'Find the word
Pointer = InStr(Str1, "in")
If Pointer > 0 then
....
'Return the "line" of text. In this instance, it would return:
'"My search will find a word in this line."
....
I don't need the vbcrlf, but i can filter that out after the fact.
Brewguru99