forum

Home / DeveloperSection / Forums / vbscript skipline and cr line endings

vbscript skipline and cr line endings

Anonymous User 2938 20-Jun-2013
Hi Expert,

For some reason when I use the objFile.ReadLine method to read my text file, the entire file is returned as one long line. The file I'm opening is using CR line endings instead of CRLF or LF line endings. Does anyone know how I can read this file line by line in vbscript if ReadLine does not recognize CR line endings? Code is below:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set txsInput = objFSO.OpenTextFile("C:\Path\To\My\File.csv",1)
'Read lines one by one
Do While txsInput.AtEndOfStream <> True
  strTemp = txsInput.ReadLine
  msgbox strTemp
Loop

Instead of alerting for each line, I get one alert with the entire file. Any help is appreciated.

Updated on 20-Jun-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By