I Have no idea why the testoutfile.txt should be empty.
There is a mistake in the code, it uses all lines with "solution" imnstead of those without.
I changed it:
VB Code:
Dim DatNr1 As Integer Dim DatNr2 As Integer Dim strTextLine As String Dim ret As Integer DatNr1 = FreeFile Open "outfile.txt" For Input As DatNr1 DatNr2 = FreeFile Open "testoutfile.txt" For Output As DatNr2 Do While Not EOF(DatNr1) Input #DatNr1, strTextLine ret = InStr(1, LCase(strTextLine), "solution") If ret = 0 Then Write #DatNr2, strTextLine Else Write #DatNr2, End If Loop Close #DatNr1 Close #DatNr2
the resulting file I get when using your "outfile.txt" is attached!




Reply With Quote