Solved

Write to textfile problem

Posted on 2004-08-24
5
215 Views
Last Modified: 2010-05-02
Hi,

this is the problem I have:

I wrote a little program to write some data to a textfile.

Open "g:\transfer\convertedADBsap.txt" For Output As #1
...
Write #1, strDatum & strKey & strDescription
...
Close #1

This program works great but when I look in the created textfile(with notepad) I see:

"20040731 1 test"

I would like to become 20040731 1 test without the " ".  Is this possible? Suggestions?

Thanks
0
Comment
Question by:gollem
[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
5 Comments
 
LVL 18

Expert Comment

by:JR2003
ID: 11880237
Write #1, Trim(strDatum) & Trim(strKey) & Trim(strDescription)
0
 
LVL 8

Accepted Solution

by:
mladenovicz earned 50 total points
ID: 11880238
Open "g:\transfer\convertedADBsap.txt" For Output As #1
Print #1, strDatum & strKey & strDescription
Close #1
0
 
LVL 18

Expert Comment

by:JR2003
ID: 11880253
Sorry I misunderstood.

Dim strText as String
strText = strDatum & strKey & strDescription
strText = Right(strText, Len(strText) - 1)
strText = Left(strText, Len(strText) - 1)
Write #1, strText
0
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 20 total points
ID: 11880273
Yes it's possible:

Write places strings in double quotes, separates values with commas, and adds a CR/LF pair at the end of each command. Read the data back with Input.

Print does not add extra delimiters, but does concatenate a final CR/LF to each line. The CR/LF can be suppressed by ending the command with a semicolon (;). (This trick has been available in every Basic I've used, but it is not documented in the VB 6.0 Help.) Read it back with Line Input. (Line Input assumes a DOS type ASCII input file where each line is terminated with CR/LF. It does not recognize the unix line termination character.)

Print #1, strDatum & strKey & strDescription ;
0
 

Author Comment

by:gollem
ID: 11880408
Hi,

thanks guys exactly what I needed.  I'll give the points to mladenovicz because he had the fastest solution first, but I'll add 20 points for dhaest for his great comment.

JR2003 I've tested your solution but I still get " " in my textfile.

The print statement was the key I needed.

Thanks again for your time and quick reply.

Gollem
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

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