Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
reverse value | Excel Worksheet Functions | |||
for each...next in reverse | Excel Programming | |||
For each...next reverse | Excel Programming | |||
For...next in reverse | Excel Programming | |||
In Reverse... | Excel Programming |