![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi Guys,
So I need to import a large text file into an array. I only need the last 5,000 lines or so. Most of the files are ok, but occasionally (around 30000 lines) I get an overflow error. Since I only need the last five thousand lines or so, is there a way to delete the beginning part of the array as more is added after 5,000 lines, I.E. when line 5001 is imported line 1 gets erased? I tried the below but still got the overflow error. I wouldn't have to delete pieces of the array one at a time, either - I could say that at 10,000 the first 5000 get deleted, at 15,000 the next 5000 get deleted, etc. Or might I just be better off reading the file twice to count the lines? Code:
Do While Not fo.AtEndOfStream
Count = Count + 1
ReDim Preserve AllArray(Count)
AllArray(Count) = fo.ReadLine
'If Count > 5000 Then AllArray(Count - 5000) = ""
Loop
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Delete bookmark which doesn't have a name
|
rarulkumar | Word VBA | 2 | 04-19-2013 03:19 AM |
| Control direction of resizing textarea on overflow | noodle | PowerPoint | 0 | 03-31-2013 04:52 AM |
Convert String Array to Integer Array from a User Input?
|
tinfanide | Excel Programming | 4 | 12-26-2012 08:56 PM |
Files beginning ~$
|
RobinW | Word | 1 | 06-28-2012 05:35 PM |
Before the table but after beginning of doc?
|
Jaymond Flurrie | Word VBA | 2 | 08-16-2011 06:27 AM |