VB Code:
Dim file As String
Open "C:\Test.txt" For Input As #1: file = Input(LOF(1), #1): Close #1
file = Replace(file, "Selected car xxx", "Selected car " & Label1.Caption, 1, 1)
Open "C:\Test.txt" For Output As #1: Print #1, file: Close #1
That'll replace the first instance of "Selected car xxx" and no other, with "Selected car " & the label's caption.
If your string or file contains several instances of "Selected car xxx" before the one you wish to replace, you can simply do something like:
VB Code:
Dim file() As String, i As Integer, count As Integer: count = 0
Open "C:\Test.txt" For Input As #1: file = Split(Input(LOF(1), #1), vbCrLf): Close #1
For i = 0 To UBound(file)
If InStr(file(i), "Selected car xxx") > 0 Then count = count + 1
If count = 4 Then 'Find the fourth instance of the phrase
newfile = newfile & Replace(file(i), "Selected car xxx", "Selected car " & _
Label1.Caption) & vbNewLine
Else
newfile = newfile & file(i) & vbNewLine
End If
Next
Open "C:\Test.txt" For Output As #1: Print #1, Mid(newfile, 1, Len(newfile) - 2): Close #1
In that example, it will find the 4th instance of "Selected car xxx" and replace only it with "Selected car " & Label1.Caption, and leave the other instances alone. Change the "4" in:
...to whatever number instance you wish to find(26th, 62nd, whatever).
If all you need to do is replace something that will ALWAYS be on a certain line, then you could use one of the examples already provided by the other users here ;D