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

Skip Lines in text file

Status
Not open for further replies.
May 31, 2007
31
0
0
AE
Please can anybody assist, I am trying to skip lines in a text file and cant seem to figure why this is not working. Thanks in advance

tmp_file = "C:\test.dat"

Const ForReading = 1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTS = objFSO.OpenTextFile(tmp_file, 1)

i = 0
tmpstr = ""
break = False

Do While (objTS.AtEndOfStream <> False)

do While break <> True

i = i + 1

If i = 469 Then

break = True

End If

objTS.SkipLine

Loop

tmp = objTS.readline

tmpstr = tmpstr & tmp & VbCrLf

Loop

objTS.Close

WScript.Echo (tmpstr)

Set objFSO = Nothing
Set objTS = Nothing
 
[tt]Do While (objTS.AtEndOfStream = False)
i = i + 1
If i < 469 Then
objTS.SkipLine
else
tmpstr = tmpstr & objTS.readline & VbCrLf
end if
Loop[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top