cosfreelance
MIS
Hi,
I have large text files (6mb - 10mb) that contains invoice data. need to open the text file and extract a range of pages and save it to a new file. I plan to read the text file into a array and search the array for the start and end pages that will be set using variables. The script i have so far is as follows:
Dim arrFileLines()
Dim PgStart
Dim PgEnd
PgStart = 1000
PgEnd=1023
i = 0
tmpdata = ""
Set objFile = filesys.OpenTextFile(LS_TEMPFILE, 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close
For l = Lbound(arrFileLines) to UBound(arrFileLines) Step 1
tmpdata = tmpdata & arrFileLines(l)
Next
My question how do I recreate the array with the required pages set from the PgStart /PgEnd variables ?
Also having googled on the subject I understand that I can run into performance issues on large text files. An alternative method for reading the text files would be using the OpenAsTextStream method which is quite fast. However, if I was to use the OpenAsTextStream method how would I extract the relevant pages needed.
Thanks
I have large text files (6mb - 10mb) that contains invoice data. need to open the text file and extract a range of pages and save it to a new file. I plan to read the text file into a array and search the array for the start and end pages that will be set using variables. The script i have so far is as follows:
Dim arrFileLines()
Dim PgStart
Dim PgEnd
PgStart = 1000
PgEnd=1023
i = 0
tmpdata = ""
Set objFile = filesys.OpenTextFile(LS_TEMPFILE, 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close
For l = Lbound(arrFileLines) to UBound(arrFileLines) Step 1
tmpdata = tmpdata & arrFileLines(l)
Next
My question how do I recreate the array with the required pages set from the PgStart /PgEnd variables ?
Also having googled on the subject I understand that I can run into performance issues on large text files. An alternative method for reading the text files would be using the OpenAsTextStream method which is quite fast. However, if I was to use the OpenAsTextStream method how would I extract the relevant pages needed.
Thanks