I wondered if anybody could help me. I'm trying to amend the below script so it removes a specific line within a text file. I'm baffled as to what part i need to amend below so it removes the exact line I want.
Const FOR_READING = 1
Const FOR_WRITING = 2
strFileName = "\\jarvisfs1\groups\InforIFC\Licence_BOB\NEW\test3.txt"
iNumberOfLinesToDelete = 5
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(strFileName, FOR_READING)
strContents = objTS.ReadAll
objTS.Close
arrLines = Split(strContents, vbNewLine)
Set objTS = objFS.OpenTextFile(strFileName, FOR_WRITING)
For i= 0 To UBound(arrLines)
If ShouldSkip(i) Then
objTS.WriteLine arrLines(i)
End If
Next
Function ShouldSkip(i)
Dim arrSkipLines, x
arrSkipLines = Array(1, 22, 32, 42, 169)
For Each x In arrSkipLines
If x = i Then
ShouldSkip = True
Exit Function
End If
Next
ShouldSkip = False
End Function