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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read a from a text file 1

Status
Not open for further replies.

ranman76

Programmer
Oct 28, 2002
5
US
I need to read a specific line from a text file (I.E. Line 8). How would I go about doing so efficiently? I will need to eventually load the line into a String.
 

Something like this should work

[tt]

Dim FName As String, FNumb As Integer, TextLine As String, I As Integer

FName = "Your Path To File"
FNumb = FreeFile

Open FName For Input As #FNumb

For I = 1 To 8
If EOF(FNumb) Then Exit For
Line Input #FNumb, TextLine
If EOF(FNumb) Then Exit For
Next I

'I should = 9 if it did not reach eof first and TextLine should contain your string

[/tt]

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top