Solved

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

Posted on 2003-12-03
4
680 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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