Writing Files


WRITE - Writes a series of values, with each value seperated by a comma and enclosed in speech marks.
PRINT - Writes a series of values with each value seperated by a tab character.
PUT - Writes data from a record into a text file.


Three types of text file are supported
CSV - comma seperated value - columns of data are seperated by a comma and each row is seperated by a carriage return.
PRN - columns of data are aligned by character position and each row of data ends in a carriage return.
TXT - tab delimited - columns of data are seperated by tabs and each row is separated by a carriage return.


Writing data to a textfile

Public Sub WritingData 
Dim iFileNumber As Integer
Dim sTheText As String
Dim sFileName As String

   iFileNumber = FreeFile
   sTheText = "The text that I want to add to the file"

   sFileName = "C:\Temp\Text.txt"
   Open sFileName For Output As #iFileNumber
   Print #iFileNumber, sTheText
   Close #iFileNumber
End Sub


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext