I am trying to use a script to remove the blank spaces from the right side of a line, for every line on the file. It sounds simple and should be, I think. I will post the code below. The problem is that if the file has like 1000 lines in it, it will work great for every line except the very first line. The very first line will remain in the file with the blank spaces, Why?
(See code below)
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\ITI\I00test", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strLine = Trim(strLine) & vbCrLf
strText = strText & strLine
Loop
objFile.Close
Set objFile = objFSO.OpenTextFile("C:\iti\I00test", ForWriting)
objFile.Write strText
objFile.Close
Thanks,,
Richtoss
(See code below)
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\ITI\I00test", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strLine = Trim(strLine) & vbCrLf
strText = strText & strLine
Loop
objFile.Close
Set objFile = objFSO.OpenTextFile("C:\iti\I00test", ForWriting)
objFile.Write strText
objFile.Close
Thanks,,
Richtoss