Solved

Writing to a file

Posted on 1998-12-11
5
141 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
5 Comments
 
LVL 14

Accepted Solution

by:
waty earned 200 total points
Comment Utility
  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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now