How can I overwrite the last line data in text or csv file from VB

J

Jennifer

Hello,

Is there a method that I can overwrite the last line of csv/text file
WITHOUT reading the whole file from the first line from Excel VBA ?

I am trying to read the last line of data and use if function to determine
if it would be overwritten. Besides reading the whole file in and rewriting
all of them out, is there another efficient way to handle it?
 
G

Gary Brown

You can read the whole file but only remember the last line so you're not
using up lots of memory.
This only remembers the last record read...
Do While Not EOF(iFileNum)
Input #iFileNum, strEachRecord
strLastLine = strEachRecord
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top