[AccessD] Create and write Text File

Stuart McLachlan stuart at lexacorp.com.pg
Mon Sep 26 16:44:19 CDT 2005


On 26 Sep 2005 at 14:22, Reuben Cummings wrote:

> Anyone have a routine to create a text file and write to that text file?
> 
> I have the routine to create the strings to be added.  Now I just need to
> create a text file and then write each string to that file.  There could be
> anywhere from 1 to 250 strings to be added and each needs to be its own
> line.
> 

Once upon a time this was "bread and butter" to any BASIC programmer.
Strange how few people do it these days :-)

Function WriteFile(Filename as String)
Dim intFile as INteger
'Get next available file handle
intFile = FreeFile
'create file (overwrites any exisiting file) 
Open Filename for Output as intFile 
Do
    'call routine to create next string
    strLine = ...........
    'write to file
    Print #intFile, strLine
Loop Until.......
'Close the file
Close #intFile
End Function-- 
Stuart





More information about the AccessD mailing list