View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default How to add data into a text file without overwriting existing data

What you didn't include in your message was your Open statement. If you open
the destination file for Output, existing contents are destroyed. If you
open it for Append, new content is added to the end of the file.

Open "C:\Test.txt" For Append Access Write As #FileNum


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"J@Y" wrote in message
...
I'm using

Print FileNumber, LineofText

to copy one line of text from one text file to another text file. If I
close
the file and reopen them to write again, the previous data gets erased.
How
do I open the write file so what is already in it stays and what I add to
it
follows ?