Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Write in a text file without vbCrLf vb6

Posted on 2009-04-13
5
Medium Priority
?
1,560 Views
Last Modified: 2012-05-06
Hello!
   I need to write in a text file in Visual Basic 6 some text lines but without the vbCrLf automatically inserted at the end of the line. If i use the following code:
   
   Open App.Path & "\TextFile.txt" For Output As #1
        Print #1, "Some text"
    Close #1

  this automatically inserts me an vbCrLf (Enter key) at the end of every line. I need to be able to choose if i want to insert Chr(13) or Chr(10) or both in a construction like this:
        Print #1, "Some text" & Chr(13)

    How can i do this?

 Thank you!
0
Comment
Question by:Cristi_E
[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
  • 2
5 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24129920
Hello Cristi_E,

I think write supports this but afaik appends quote marks to strings - don't know if this is a problem of itself for you?

Regards,
Chris
0
 
LVL 4

Author Comment

by:Cristi_E
ID: 24129977
I dont really understand this part: "but afaik appends quote marks to strings ". Please can you be a little more explicit?
    Thank you!
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24130260
afaik - as far as I know

Print #1, "Some text"
results in:
Some Text
with the CR LF being written to stream #1

Write #1, "Some text"
results in:
"Some Text"
 being written to stream #1 ... but no CR LF

Chris

0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 24131122
Put a semi-colon after the text.
Dim f As Integer
f = FreeFile
Open "C:\NoVbCr.txt" For Output As #f
    Print #f, "Text1" & vbCr;
    Print #f, "Text2" & vbCr;
Close #f

Open in new window

0
 
LVL 4

Author Closing Comment

by:Cristi_E
ID: 31569503
Thank you verry much!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Make the most of your online learning experience.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

670 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