> Ha! -- For Append, not For Output. <g>
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).
Rick Rothstein (MVP - VB) - 31 Aug 2006 14:56 GMT
> Open App.Path & "\sinfo.txt" For Append As #1
> Print #1, title & " " & Artist
[quoted text clipped - 3 lines]
> 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
Henning - 31 Aug 2006 15:07 GMT
> Open App.Path & "\sinfo.txt" For Append As #1
> Print #1, title & " " & Artist
[quoted text clipped - 3 lines]
> 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).
Print #1, vbcrlf & title & " " & Artist
/Henning
Henning - 31 Aug 2006 15:10 GMT
> Open App.Path & "\sinfo.txt" For Append As #1
> Print #1, title & " " & Artist
[quoted text clipped - 3 lines]
> 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).
To keep the end of line as before,
Print #1, vbcrlf & title & " " & Artist;
/Henning
Dan - 31 Aug 2006 16:49 GMT