Gary Croxford
asked on
Writing text to a file, quotation marks doubling up VB6
Thank you for lookig at my question,
I am trying to output a line of data to a text file as a string in the format:
"01","0","IDNo","Hour:Minu tes","DD/M M/YYYY","W eekDayNo"
The Hours, Minutes, Date and Day Number are derived from declared values but the first part of the string - "01","0","IDNo" - is hard-coded.
I can reproduce the string in the format I need in a msgbox as check on what is about to be written to the file but whether I use Chr$(34) or two double quotation marks the text in the output file always has double double-quotes in the body of the string.
"01"",""0"",""IDNo"",""Hou r:Minutes" ",""DD/MM/ YYYY"",""W eekDayNo"
How do I force only single instances of double-quotes?
I am trying to output a line of data to a text file as a string in the format:
"01","0","IDNo","Hour:Minu
The Hours, Minutes, Date and Day Number are derived from declared values but the first part of the string - "01","0","IDNo" - is hard-coded.
I can reproduce the string in the format I need in a msgbox as check on what is about to be written to the file but whether I use Chr$(34) or two double quotation marks the text in the output file always has double double-quotes in the body of the string.
"01"",""0"",""IDNo"",""Hou
How do I force only single instances of double-quotes?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
... and would be saved as such
Print #f, strText
Print #f, strText
Use WriteLine for writing CSV files (1- file No):
WriteLine(1, "01", "0", "IDNo", Var1, Var2)
Format Var1 and Var2 properly
WriteLine(1, "01", "0", "IDNo", Var1, Var2)
Format Var1 and Var2 properly
ASKER
Thank you, that solved the problem
You're welcome and I'm glad I was able to help.
The 'About Me' page in My profile contains links to some articles I've written that may interest you.
Marty - MVP 2009 to 2012
The 'About Me' page in My profile contains links to some articles I've written that may interest you.
Marty - MVP 2009 to 2012
Open in new window