First of all, be aware that whenever a VBScript fails, it fails entirely. In other words, it doesn't perform part of what it's supposed to do until it errors out. So you either have to fix it, or remove it completely.

As for the memory issue, could it be that this text file does not have any CR/LF and is just a lonnnnnnnnnnng single line? If that line is more than 64K long it could overrun the string buffer in the document. That might not be the issue but it's worth a double-check.
Technical Product Manager
I don't want to achieve immortality through my work; I want to achieve immortality through not dying - Woody Allen