I just made a function that will read between specific lines for you, say you want to only get the lines 20-40 in your text file, you use this. If you only want one line, just use the same number for upper and lower
VB Code:
Option Explicit Dim str2buff As String Private Sub Form_Load() Call GetLineInfo("C:\Documents and Settings\Jason\Desktop\response.txt", 20, 40) MsgBox str2buff End Sub Public Function GetLineInfo(txtfile As String, lowerline As String, upperline As String) As String Dim ff As Integer Dim strbuff As String Dim LineCount As Long Dim yay As String LineCount = 0 ff = FreeFile lowerline = lowerline - 1: upperline = upperline - 1 Open txtfile For Input As #ff Do Until EOF(ff) LineCount = LineCount + 1 Line Input #ff, yay yay = vbNullString If LineCount >= lowerline And LineCount <= upperline Then Line Input #ff, strbuff str2buff = str2buff & vbNewLine & strbuff ElseIf LineCount > upperline Then Exit Function End If Loop End Functionenjoy




enjoy

Reply With Quote