Solved

Writing text to a file, quotation marks doubling up VB6

Posted on 2013-01-03
6
356 Views
Last Modified: 2013-01-03
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:Minutes","DD/MM/YYYY","WeekDayNo"

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"",""Hour:Minutes"",""DD/MM/YYYY"",""WeekDayNo"

How do I force only single instances of double-quotes?
0
Comment
Question by:Crxfrd
[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
6 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 38740263
This displays in standard CSV format
Dim strText As String

strText = """01"",""0"",""IDNo"",""Hour:Minutes"",""DD/MM/YYYY"",""WeekDayNo"""
MsgBox strText

Open in new window

0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 38740265
If you are using Write # to create the file, use Print # instead. If not then please show your code.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 38740276
... and would be saved as such

Print #f, strText
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Expert Comment

by:als315
ID: 38740310
Use WriteLine for writing CSV files (1- file No):
WriteLine(1, "01", "0", "IDNo", Var1, Var2)
Format Var1 and Var2 properly
0
 

Author Closing Comment

by:Crxfrd
ID: 38740570
Thank you, that solved the problem
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 38740584
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
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

751 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