Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default ReadLine in Reverse

Is there a way to read a text file from the bottom up? I have a text file
that is going to get very big, and I am only interested in reading the bottom
of the file. And I would like to reverse the order so that the last entry is
displayed first.
--
Thanks,
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ReadLine in Reverse

How big is "very big"? Also, "displayed first" where? How many lines
represents "the bottom of the file"?

If "very big" file is under, say, 10-15 Megs, this approach should work fine
(15 to 50 Megs will work too; but speed, or lack thereof, may start to
become a concern)...

Sub GetEndOfFile()
Dim X As Long
Dim FileNum As Long
Dim TotalFile As String
Dim Records() As String
FileNum = FreeFile
Open "c:\temp\YourTextFile.txt" For Binary As #FileNum
TotalFile = Space(LOF(FileNum))
Get #FileNum, , TotalFile
Close #FileNum
Records = Split(TotalFile, vbCrLf)
'
' At this point, the Records array contains each "paragraph",
' which I'm guessing would be your "entry"; just read it from
' last entry upward and put it wherever you want. Something
' like this (using a TextBox as your display vehicle)...
'
' For X = UBound(Records) To Ubound(Records) - 10 Step -1
' TextBox1.Text = TextBox1.Text & vbCrLf & Records(x)
' Next
End Sub

Rick


"Mike Archer" wrote in message
...
Is there a way to read a text file from the bottom up? I have a text file
that is going to get very big, and I am only interested in reading the
bottom
of the file. And I would like to reverse the order so that the last entry
is
displayed first.
--
Thanks,
Mike


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
reverse value Mike Excel Worksheet Functions 0 March 28th 07 12:08 AM
for each...next in reverse Rod Jones[_3_] Excel Programming 2 October 13th 04 08:59 AM
For each...next reverse Rod Jones[_3_] Excel Programming 1 October 12th 04 02:57 PM
For...next in reverse Rod Jones[_2_] Excel Programming 3 October 12th 04 02:38 PM
In Reverse... stck2mlon[_13_] Excel Programming 12 June 2nd 04 11:45 PM


All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"