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

Text File Read

Status
Not open for further replies.

sshafe

Programmer
Oct 18, 2002
71
US
I am trying to figure out how to find a line in a text file that contains the current date and read from that line to the end of file. The file is a log file that contains a date and time on each line. So once I get to the line that has the current date, I want to start reading from there.

Any ideas of how to do this?

Thanks in advance
 
ForReading = 1
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FileContent = FSO.OpenTextFile("FILENAME", ForReading)
Do While Not FileContent.AtEndofStream
Temp = FileContent.ReadLine
If instr(Temp, Date()) Then 'Found todays's date
Content = Temp & vbCrLf & FileContent.ReadAll
Exit Do
End If
Loop

Content will contain the rest of the file

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top