When creating certain sorts of applications (e.g. Virus Scanner), you will want to be able to create a log of the scanners tasks. However if you used the previous example, you would overwrite the previous entry, as you entered the new one. This code opens test.txt and adds a entry to the end of a file
Dim nFileNum As Integer
' Get a free file number
nFileNum = FreeFile
' Open Test.txt for append
Open App.Path & "c:\test.txt" For Append As nFileNum
' Add the contents of TextBox1 to Test.txt
Print #nFileNum, TextBox1.Text
' Close the file
Close nFileNum
Comments