-
Each time through the Do While loop, the code reads 2 lines and writes one. That's because the code calls Readline twice whether the If expression is True or False. Each call to Readline reads another line from FSOFile.
Another problem is this line:
[vba]FSOFileRevised.WriteLine (Left(tempStr, Len(FSOFile.ReadLine) - 14))[/vba]
No value was assigned to tempStr, so that code has the same effect as:
[vba]FSOFileRevised.WriteLine ""[/vba]
See if this Do While loop does what you want:
[vba] Do While Not FSOFile.AtEndOfStream
tempStr = FSOFile.ReadLine
If Mid(tempStr, 2, 4) = "APIF" Then
FSOFileRevised.WriteLine (Left(tempStr, Len(tempStr) - 14))
Else
FSOFileRevised.WriteLine (tempStr)
End If
Loop [/vba]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules