Solved

Writing to a file

Posted on 1998-12-11
5
143 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 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…

770 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