Solved

How to remove double-quotes when writing to a text file?

Posted on 2003-12-03
4
689 Views
Last Modified: 2013-12-18
Hi all,

I have a program to write the content of a document to a text file when the user clicks on a button.

Here is a part of the program:

fileNum = Freefile()
fileName = "C:\Sample.txt"
Open fileName For Output As fileNum
tmpContent = doc.P1(0) +"|"+ doc.T1(0) +"|"+ doc.DSO1(0) +"|"+ doc.DO1(0) +"|"+ doc.PS1(0) +"|"+ doc.PSG1(0) +"|"+ _
doc.RS1(0) +"|"+ doc.PO1(0) +"|"+ doc.POG1(0) +"|"+ doc.RO1(0) +"|"+ doc.S1(0) +"|"+ doc.OI1(0) +"|"+ doc.CL(0)
Write #fileNum, tmpContent
Close fileNum

However, after writing to the text file, the content in the text file is wrapped by "double-quotes", eg. "abc|def|ghi|jkl|mno|pqr".
How can I remove the double-quotes?

Thanks very much in advance!

kspuea
0
Comment
Question by:kspuea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 9871517
Try opening the file for BINARY access.
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 9871529
Also, declare tmpContent as String explicitly.
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 50 total points
ID: 9871620
Hi jjperez2,

Replace the "WRITE" statement with a "PRINT" statement, like so:

Print #fileNum, tmpContent

The WRITE statment always uses delimiters:
Write # statement  

Writes data to a sequential text file with delimiting characters.

Numeric      Omits leading and trailing spaces.
String      Encloses all strings in double quotation marks. Pads fixed-length strings with spaces as needed.



Best regards,
qwaletee
0
 

Author Comment

by:kspuea
ID: 9871807
Hi qwalette, thanks very much! Your method works wonderfully!
Finally I solved my problem.
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question