Re: Append new line to Text File
- From: "Rick Rothstein \(MVP - VB\)" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx>
- Date: Thu, 31 Aug 2006 09:56:12 -0400
Open App.Path & "\sinfo.txt" For Append As #1
Print #1, title & " " & Artist
Close #1
When I use the above code in a file that already has one line of text,
it just puts the stuff at the end of the line not on a new line. (I
don't want to use write because I don't want quotes around my text).
That means the existing line you have in your file was not put there with
the above code. The Print statement (as written) puts the new line of text
into the file with a trailing Windows newline character sequence (carriage
return followed by a line feed), so each line it adds to the file goes on
the next line. If you open your existing file in a text editor, put the text
cursor at the end of the file (it will be right after the last letter of the
last word), hit the Enter Key (to put a newline character sequence after it)
and then save the file back out... then the above code will work correctly
from there on out. The key to maintaining a file of data is consistency in
how data is added to the file.
Rick
.
- References:
- Append new line to Text File
- From: Dan
- Re: Append new line to Text File
- From: Rick Rothstein \(MVP - VB\)
- Re: Append new line to Text File
- From: Randy Birch
- Re: Append new line to Text File
- From: Rick Rothstein \(MVP - VB\)
- Re: Append new line to Text File
- From: Dan
- Append new line to Text File
- Prev by Date: VB6 Auto Updating App
- Next by Date: Re: Append new line to Text File
- Previous by thread: Re: Append new line to Text File
- Next by thread: Re: Append new line to Text File
- Index(es):
Relevant Pages
|