Solved

file output using write

Posted on 2000-03-28
10
175 Views
Last Modified: 2010-05-02
Greetings,

i was wondering if it is possible to stop VB from surrounding everything written to a file using 'write' in quotes ("")

eg
----

fileno = freefile
open app.path & "\test.txt" for output as fileno
write #fileno, "testing"
close fileno

----
ends up with a file containing

"testing"

Any ideas?
0
Comment
Question by:wolfjjj
[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
  • 2
  • +3
10 Comments
 
LVL 28

Expert Comment

by:Ark
ID: 2666061
Hi
If you are using Write to save strings with commas etc, you NEED this quotes to reed this file correctly next time. If you haven't commas etc, you can use Print statement:
Print #fileno,"testing"
Cheers
0
 
LVL 3

Expert Comment

by:Gordonp
ID: 2666188
yeh, what ark said.

Write, outputs your data to a file, in a format that allows them to be correctly read in again using input.

this means your strings will be surrounded by quotes, and your date variables would be surrounded by #.

if your Saving data to a file, and want to be able to retrieve it accurately.

use Binary file access, and the Put and Get functions.

Gordon


0
 
LVL 18

Expert Comment

by:deighton
ID: 2666462
The soultion is to use

ileno = freefile
                   open app.path & "\test.txt" for output as fileno
                   print #fileno, "testing"
                   close fileno
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 18

Expert Comment

by:deighton
ID: 2666464
opps, already said
0
 
LVL 24

Expert Comment

by:SunBow
ID: 2675147
ditto.
My peers prefer the quotes for general import purposes, but I don't. So, RU
Done?
0
 

Accepted Solution

by:
monteh earned 15 total points
ID: 2685319
You could also open the file for Binary.

Open "c:\test2.txt" For Output As fileno
' write an ANSI string
Put #fileno, , "testing"
0
 
LVL 28

Expert Comment

by:Ark
ID: 2685599
Great :-)
>You could also open the file for Binary.
> Open "c:\test2.txt" For Output As fileno
' write an ANSI string
>Put #fileno, , "testing"

First,
you'll get an Error, because though you wrote <binary>, in your code you open for Output.
Second,
You can also open the file for ANY to write the string, but only "Write" statement put quotes. First you have to decide - how will you read this file in future (see Gordonp comment).
Cheers
0
 

Expert Comment

by:monteh
ID: 2685612
Yes, sorry, I meant Open For Binary.
0
 
LVL 1

Author Comment

by:wolfjjj
ID: 2706299
graded so low because you got it right in your description, but your code let u down
0
 
LVL 24

Expert Comment

by:SunBow
ID: 2708619
I agree on comparative grade, but more 'cause I'd go with: follow the leads in Ark and Gordonp (even deighton) first.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

695 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