Hi there!
Don't know if I'm just having a brain lock-up or if there's something wrong with TextStreamObject.AtEndOfLine
For the purposes of teaching myself the FileSystemObject, I'm just simply copying one file to another, line-by-line. However, it copies everything except the last line. Here's a code snippet:
Set fso = New FileSystemObject
Set OrigFile = fs
penTextFile(strFileName, ForReading, False)
Set NewFile = fso.CreateTextFile(strFileName2, True)
Do While OrigFile.AtEndOfStream <> True
NewFile.WriteLine (OrigFile.ReadLine)
OrigFile.SkipLine
Loop
It looks like when I SKIPLINE to the last line, AtEndOfStream = True and the code never gets a chabxce to copy the last line. Any recomendations on how to avoid that problem? Thanks!
PTW
Don't know if I'm just having a brain lock-up or if there's something wrong with TextStreamObject.AtEndOfLine
For the purposes of teaching myself the FileSystemObject, I'm just simply copying one file to another, line-by-line. However, it copies everything except the last line. Here's a code snippet:
Set fso = New FileSystemObject
Set OrigFile = fs
Set NewFile = fso.CreateTextFile(strFileName2, True)
Do While OrigFile.AtEndOfStream <> True
NewFile.WriteLine (OrigFile.ReadLine)
OrigFile.SkipLine
Loop
It looks like when I SKIPLINE to the last line, AtEndOfStream = True and the code never gets a chabxce to copy the last line. Any recomendations on how to avoid that problem? Thanks!
PTW