Follow @dporton

JustCode : Loop File a line at a time

This code shows us how to open a file in readonly mode and skip through it a line at a time.

’ ****************************************
‘ Designed by : Smarter Dimensions
‘ Last Updated : 24th July 2009
‘ Loop File a line at a time.
‘ ****************************************

Dim oFSO, oFile

Set oFSO = CreateObject(“Scripting.FileSystemObject”)
Set oFile = oFSO.OpenTextFile(“C:\temp\test.txt”,1,false,0)

Do While oFile.AtEndOfStream = false
DEBUG.Log(oFile.ReadLine)
Loop

oFile.Close()


					

Leave a Comment

%d bloggers like this: