Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default How can I overwrite the last line data in text or csv file from VB

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default How can I overwrite the last line data in text or csv file from VB

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

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Jennifer" wrote:

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?

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
How to overwrite data in file? Joe User[_2_] Excel Programming 0 December 10th 09 10:28 PM
Parsing Data String from text file line gtslabs Excel Programming 1 April 21st 07 08:13 PM
Reading a text file line by line stressman Excel Programming 3 October 16th 05 05:29 AM
Reading a text file line by line Foss[_2_] Excel Programming 4 March 16th 05 04:01 PM
import huge text file line-by-line? rachel Excel Programming 2 November 6th 04 04:43 PM


All times are GMT +1. The time now is 03:38 PM.

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

About Us

"It's about Microsoft Excel"