View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
john john is offline
external usenet poster
 
Posts: 5
Default FileSystemObject to get last 10 lines of text file.

Hi Dave,

Thanks for the link.

I gave the code a quick go (Excel) and it fell flat on it's face. Before I
go asking how to make it work, were you pointing to this code as a 'how to'
within VBA, or an indication as to the results using that approach?

If there are no HUGE benefits from the FileSystemObject, then the File Line
# method is probably the quickest/appropriate direction, yes? (Although I
stepped through a procedure and watched it go over and over till it got to
the last line:(

To explain a little further (Hi Tom): The file in question is a logfile that
updates by adding a few extra lines of data each time an action/change is
made within a -browser based- application (which I cannot gain access to or
control). The section (Say 10 lines detailing Log-off time) I'm interested
in catching, is appended when the application closes/logs off.

I have looked into detecting the Findwindow (title) to detect when the
application isn't in use, as a bases to either check the logfile, or record
a time when the application was stopped... But that was a no go, as the
application is itself appears to be running within an application and whats
worse, the window title doesn't change even when a different role is being
performed within that application... Thats right, it's a horrible situation!

So I'm back to looking at the end of the log-file every time a change occurs
within the application, which funnily enough, I can detect via the FileDate
change function to detect file properties.

Now that I've wrote out all the negatives, I bet I've also convinced you I'm
on a looser!

Thanks again!

Dave Peterson wrote in message
...
I searched google in the *scripting* newsgroup and found this:

http://groups.google.com/groups?thre...%40tkmsftngp10

The last post in the thread contained this:

This code takes 4 seconds to get last 10 lines out of 221,000 Lines regdmp
File.



john wrote:

Hi there,

I am interested in finding out how to read the last 10 lines (or so) of

a
text file using the FileSystemObject function, rather than looping

through a
text file line-by-line until the end is reached then working backwards.

I may be looking at reading the last 10 lines of a large text file

almost
every second, and would be interested in the fastest method available.

If anyone can explain how this could be done, I'd be very grateful!

Thank you.


--

Dave Peterson