Visual Basic Programming Code Examples Visual Basic > Code Snippets Code Examples Add lines of text to a file Add lines of text to a file Private Sub Form_Load() 'Replace 'c:\test.txt' with the name of the file you want to edit. Open "c:\test.txt" For Append As #1 'Replace 'new line added' with the line you want to insert to the file. Print #1, "new line added" Close #1 End Sub