Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching a text file with VBA

Status
Not open for further replies.

JacobY

Programmer
Jul 27, 2002
6
US
I am trying to gather the value from a line after another line...

Sub GetLayerNames()
Dim DPFLine As Variant
Dim I As Integer
Open "C:\Documents and Settings\JEY\Desktop\DEMO.las" For Input As #1
While Not EOF(1)
Line Input #1, DPFLine
If DPFLine = " 8" Then
'Here is where I want to get the next line
'out of the text file

End If
Wend
Close #1

Thanks in advance

Jake
 
Code:
Do While Not EOF(1)
    Line Input #1, DPFLine
    If DPFLine = "  8" Then
        'grab next line 
        Line Input #1, DPFLine
        Exit Do
    End If
Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top