Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-14-2014, 08:15 PM
omahadivision omahadivision is offline Is there a way to delete the beginning part of an array so it doesn't overflow? Windows 7 32bit Is there a way to delete the beginning part of an array so it doesn't overflow? Office 2007
Novice
Is there a way to delete the beginning part of an array so it doesn't overflow?
 
Join Date: Oct 2012
Posts: 28
omahadivision is on a distinguished road
Default Is there a way to delete the beginning part of an array so it doesn't overflow?

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
Thanks!
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to delete the beginning part of an array so it doesn't overflow? 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
Is there a way to delete the beginning part of an array so it doesn't overflow? Convert String Array to Integer Array from a User Input? tinfanide Excel Programming 4 12-26-2012 08:56 PM
Is there a way to delete the beginning part of an array so it doesn't overflow? Files beginning ~$ RobinW Word 1 06-28-2012 05:35 PM
Is there a way to delete the beginning part of an array so it doesn't overflow? Before the table but after beginning of doc? Jaymond Flurrie Word VBA 2 08-16-2011 06:27 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft