If you know the line # to modify then it easy you can read entire file line by line and add a counter when your counter hits your line number you append to file
Code:
Private Sub Command1_Click()
Dim sLineText As String
Dim sTemp as String
Dim ff As Integer
Dim iLineCount As Integer
Open "C:\textfile.txt" For Input As #ff
Do While Not EOF(ff)
Line Input #ff, sLineText
sTemp = sTemp & sLineText & vbNewLine
iLineCount = iLineCount + 1
If iLineCount = 4 Then
sTemp = sTemp & "My string to add." 'here i append to the file on line 4
End If
Loop
Close #ff
sTemp = Left(sTemp,Len(sTemp) - 1) 'Remove last vbNewLine
Open "C:\textfile.txt" For Output As #ff
Print #ff, sTemp
Close #ff
End Sub
This is one of the ways if you know where to append if not you will need to search for string and then append after the string