I need to write to a text file to record a set of scores. Every time I write to the text file, it overwrites what was originally in the file. Can someone tell me how to not let it overwrite what is there or how to make it start writing in an empty space?
Open the file 'for append'.
This will erase the file:
Open "C:\path\to\file.txt" For Output As FILE
This will not erase the existing content:
Open "C:\path\to\file.txt" For Append As FILE
Use text append for this
Normally append text
'Start append text to file
FileNum = FreeFile
Open "D:\45.txt" For Append As FileNum
Print #FileNum, Text1.Text
Close FileNum
'End
Saving to app path
'Start append text to file
FileNum = FreeFile
Open App.Path & "\45.txt" For Append As FileNum
Print #FileNum, Text1.Text
Close FileNum
'End
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With