I think your problem is that sokme of your data lines contain embedded carriage return / line feed characters - Chr$(13) and Chr$(10)
I created a test file in Notepad, containing lines of alphabetic characters up to 2,048 characters long. I was able to read these using Line Input, with no problems. If you want to try this test, create a command button in an Excel workbok, and add this code to it:
Code:
Private Sub CommandButton1_Click()
Dim InFile As Integer
Dim strOneLine As String
InFile = FreeFile
Open "InputTest.txt" For Input As #InFile
Do
Line Input #InFile, strOneLine
MsgBox Len(strOneLine)
Loop Until EOF(InFile)
End Sub
Create
InputTest.txt using Notepad, and save it to the same folder as your test workbook.
When you click the button, the first line of text will be read from the file, and a message box will display the length of this line. The process repeats until the end of the file is reached.
You can use this to check your actual text - get the message box to display each line, rather than the length of the line. If you see only part of what you believe is an input line, then that line contains an unwanted chr$(13) character. For example, if you think you have the line:
The quick brown fox jumps over the lazy dog
... but there is a chr$(13) character between 'fox' and 'jumps', then the test button would display the line in two halves:
1. The quick brown fox
2. jumps over the lazy dog
I hope these notes will be helpful.
Bob Stubbs (London, UK)