How do you open a text file, add lines/stuff to it, and save it?
Printable View
How do you open a text file, add lines/stuff to it, and save it?
Append to a file.
This will add text to the end of a file.Code:Open "C:\MyTextFile.txt" For Append As #1
Print #1, "My added text"
Close #1
Code:Open FileName For Action {Append, Input, Output, Binary, Random} As FileNum (Use FreeFile Function)
'For Text File, ex.
Dim FileNum As Integer
FileNum = FreeFile
Open "C:\MyFile.txt" For Append As #FileNum
Print #FileNum, "This is some Sample Text"
Close FileNum
You could read my file tutorial on my homepage, it covers the most basic things about files