Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default How to add data into a text file without overwriting existing data

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 ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
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 ?


  #3   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default How to add data into a text file without overwriting existing

Excellent. Thanks, the Append worked.

"Chip Pearson" wrote:

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 ?


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 copy none excel data & paste in 2007 without overwriting data Wakefootin Excel Discussion (Misc queries) 2 October 8th 09 12:15 AM
New data will not sort with existing data from copied file Carolyn Excel Worksheet Functions 3 January 5th 06 02:11 PM
Overwriting existing data in an Excel worksheet using ADO.Net Joel Gordon Excel Programming 6 December 2nd 04 08:34 AM
Overwriting existing data in an Excel worksheet using ADO.Net Joel Gordon Excel Programming 3 December 1st 04 08:43 AM
updating of data without overwriting the previous data updated teyhuiyi Excel Programming 0 April 7th 04 03:40 AM


All times are GMT +1. The time now is 01:47 AM.

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

About Us

"It's about Microsoft Excel"