Expand|Select|Wrap|Line Numbers
- Private Sub readFile()
- Open "example.txt" For Input As #1
- Dim sInputData As String
- While Not EOF(1)
- Line Input #1, sInputData
- If InStr(1, sInputData, "word") Then
- tbDataIn = tbDataIn & vbCrLf & sInputData
- End If
- Wend
- Close #1
___AAA
111
222
333
___BBB
333
222
___CCC
555
(the underscores are there to show a space)
...and what I want to do, is read that data in, and search for "AAA" for example (which isn't a problem), but when I find what i'm searching for, I want to pull the next lines out with it UNTIL i get to another line that starts with a space. So, if i search for "AAA", the result would be...
AAA
111
222
333