Solved

Writing to a file

Posted on 1998-12-11
5
146 Views
Last Modified: 2010-05-03
Is there a easy way to write to  a file (i.e. output.txt) without having every thing surrounded by quotes.  If i open the file as random then i'm stuck with records and data types...
I want to be able to take some text and put it in a file without quotation marks...  Is it possible...???
0
Comment
Question by:jtjcomp
[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 14

Accepted Solution

by:
waty earned 200 total points
ID: 1449535
  nFile = FreeFile
   Open sFile For Binary Access Write As #nFile

   Put #nFile, , "<DESTINATAIRE>" & NEW_LINE
   Put #nFile, , "<NOMD>" & gsUserNom & NEW_LINE
   Put #nFile, , "<PRENOMD>" & gsUserPrenom & NEW_LINE
   Put #nFile, , "<TITLE>" & gsUserTitle & NEW_LINE
   Put #nFile, , "<ETAGE>" & gsUserEtage & NEW_LINE
   Put #nFile, , "<BUREAU>" & gsUserBureau & NEW_LINE
   Put #nFile, , "<BATIMENT>" & gsUserBatiment & NEW_LINE
   Put #nFile, , "<FAX>" & gsUserFax & NEW_LINE
   Put #nFile, , "<PRINTGROUP>" & gsUserPrintGroup & NEW_LINE
   Put #nFile, , "</DESTINATAIRE>" & NEW_LINE

   Close #nFile
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1449536
Perhaps I may be able to help you on this one, but I'm not sure I understand your question - what is the significance of your remark "If you open the file as random then I'm stuck with records and data types..."

What exactly are you using this file for?

Regards,

Pino Carafa
0
 
LVL 4

Expert Comment

by:chabaud
ID: 1449537
Just open the file as text and use the print statement.

Open "output.txt" For Output As #1
print #1, "Hello world" & vbcrlf
close #1
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1449538
Yeah, standard sequential output uses quotes around the strings but the quotes themselves are *NOT* written to the file. If you have the text in a var *ONLY* the contents of the string is sent. No quotes.

M

0
 
LVL 1

Expert Comment

by:OeilNoir
ID: 1449539
if you want to increase the flexibility, if you either read or Write and don't want quotes and such, i think the best way would be with
"binary"

open "c:\file.ext" for binary as #1
put #1,, stringvariable
close #1


0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

737 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