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

  • Thread starter Thread starter Jennifer
  • Start date Start date
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?
 
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
 
Back
Top