If the file is relatively small you can also try this code
Code:
Dim strDataBuffer As String, strDataArray() As String
Dim lngRow As Long
' Create buffer large enough to hold entire contents of file
strDataBuffer = Space(FileLen(Destination & "csn.txt"))
Open Destination & "csn.txt" For Binary As #1
' Load complete file into buffer
Get #1, , strDataBuffer
Close 1
' Remove any carriage return characters (if they exist)
strDataBuffer = Replace(strDataBuffer, vbCr, "")
' Convert buffer contents into array
strDataArray = Split(strDataBuffer, vbLf)
' Process array
For lngRow = 0 To UBound(strDataArray)
' Process individual array items
Next
It will allow you to read in carriage return + linefeed formatted files (DOS/Windows) as well as linefeed only (UNIX) without needing to check beforehand.
Bookmarks