Quote Originally Posted by anhn View Post
This is NOT the case with a "pure" text file. The problem is what jmsrickland already explained.
The error happend at round 11th at the line
Input #1, tooresBind4
after all 63 lines of the file were read.

"While Not EOF(1)" need to check after every Input #1, but you do 6 consecutive Input #1 at a time before checking EOF(1), so it fails at 64th Input #1

Try this:
Code:
    Dim sLine As String
    
    Open SampFolder & "\erpmod\mod\tooresbind.sav" For Input As #1
    Open SampFolder & "\erpbind.sav" For Output As #2
    Do While Not EOF(1)
        Line Input #1, sLine
        Select Case Left$(sLine, 6)
            Case "Send3=": sLine = "Send3=t/" & Text1.Text & "~"
            Case "Send4=": sLine = "Send4=t/" & Text2.Text & "~"
            Case "Send5=": sLine = "Send5=t/" & Text3.Text & "~"
            Case "Send6=": sLine = "Send6=t/" & Text4.Text & "~"
            Case "Send7=": sLine = "Send7=t/" & Text5.Text & "~"
            Case "Send8=": sLine = "Send8=t/" & Text6.Text & "~"
        End Select
        Print #2, sLine
    Loop
    Close #1
    Close #2
Thanks a ton, that solved my problem, and i will write that down, since its a good way to do replascements.

Thank you all!


Regards