PcLinuxGuru
Technical User
I have a text file and in order for me to be able to use it I need to delete the first line. I have some code that will separate data and take the data I need and put it into a text file but when it does it creates a crlf at the top of the file and I am unable to figure out how to get rid of it without doing it manually.
I have tried a few things like this worked but it would also delete every other line rather just the first one:
Any ideas?
I have tried a few things like this worked but it would also delete every other line rather just the first one:
Code:
Set FSO = CreateObject("Scripting.FileSystemObject")
' Make sure the file exists
If Not FSO.FileExists("C:\pcs\temp\output.txt") Then
lblStatus.Caption = ("Output.txt file is missing")
Exit Sub
End If
' open the file and read all the data
strData2 = FSO.GetFile "C:\pcs\temp\Output.txt").OpenAsTextStream(ForReading).ReadAll
strData2 = FSO.GetFile("C:\output.txt").OpenAsTextStream(ForReading).ReadAll
' Split the data in to an array
arData2 = Split(strData2, vbCrLf)
' create the result array
ReDim arResult2(UBound(arData2) / 2)
For r = LBound(arData2) To UBound(arData2)
arResult2(r / 2) = arData2(r)
Next
' recreate a big string
strData2 = Join(arResult2, vbCrLf)
' save the result to a file.
Call FSO.CreateTextFile("C:\pcs\temp\Output2.txt", True, False).Write(strData2)
Set FSO = Nothing
Any ideas?