Click to See Complete Forum and Search --> : Writing text files


shaolin
February 21st, 2000, 10:19 AM
I am having a problem writing to a text file without having quotes round my strings. The help files talk about print# statement but it doesn't seem to work. What am I doing wrong.

Lothar Haensler
February 21st, 2000, 10:34 AM
try this

Open "c:\yourfile.txt" for Output as #1
print #1, "this is a string"
print #1, """this is a string""" ' will have quotes

Close #1

Kyle Burns
February 21st, 2000, 02:41 PM
If you want quotes around your strings, you can use write.

Dim sString as string
sString = "This is my text"
Write #1, sString



would put "This is my text" (in quotes) in your file. Using the Write statement put's quotes around strings, #'s around dates, and signifies boolean data by #TRUE# or #FALSE#. The Write statement also comma-delimits your data.