PDA

View Full Version : Trailing VbCrLf



joltremari
11-05-2015, 09:02 AM
Open strPath For Input As #1

While EOF(1) = False
Line Input #1, strLine
If Right(strLine, 2) = "WX" Then
'Test and manipulate data here
'Then format and write new strLine to strData
strLine2 = Left(strLine, 7)
strLine3 = Trim(strLine2)
strData = strData & vbCrLf & strLine3
Else
strData = strData & vbCrLf & Trim(strLine)
End If
Wend
Close #1

'Later, write to file

Open strPath2 For Output As #1
Print #1, strData
Close #1


The problem is that I end up with an extra vbCrLf at the end, and I can't seem to get rid of it. I need to figure out either, how to remove it before the file is written, or, how to keep it from writing a vbCrLf to the last line in the first place. Any suggestions welcome...

Thanks,
JO