Here's a snippet of code that reads in a big txt file. It used to work but the size of the INPUT text file grew such that I'm now getting an out of memory error. On a whim I changed objTS.Read(objFile.Size) to objTS.Read(objFile.Size / 20) and the file is getting read again but apparently only 1/20th of it.
I'm looking for a widget that would break the file into smaller chunks but I can't seem to find one that works.
Any advice on a different way to approach this problem?
I'm looking for a widget that would break the file into smaller chunks but I can't seem to find one that works.
Any advice on a different way to approach this problem?
Code:
File_x = Application.GetOpenFilename()
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFile = objFS.GetFile(File_x)
Set objTS = objFile.OpenAsTextStream(ForReading, TristateFalse)
EBA_File = objTS.Read(objFile.Size / 20)
'Chop up EBA_File into Smaller Strings
'***************************************************************
k = Application.RoundUp(Len(EBA_File) / 50000000, 0)
For i = 1 To k
String_Index(i) = Mid(EBA_File, (i - 1) * 50000000 + 1, 51000000)
Next i
EBA_File = vbNullString