Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Way to free memory as I input lines from a file?

Hi,

I have some code where I open a very large file into
memory then enter a loop where I input each line one by
one, analyse it & draw data from it depending on certain
criteria.

The file being opened is 216,000 lines long and when the
code is running it just seems to get slower and slower
the further down the file it gets.

My question is, can I speed it up? I'm no expert, but
what I presume is happening is that Excel is, line by
line, opening more and more of the file into memory and
keeping it there. If that's the case, is there a way of
releasing the memory (of the lines) i no longer need?

I don't totally understand what the Filehandle & Freefile
things are, I just know that they work. In fact, would it
be quicker to use (Open openfile For Binary Access Read
As #Filehandle) & return data from the file that way?
(it's all the same place).

Any help on this would be greatly appreciated!

Thanks for your time,

Steven Douglas

Below is a very cut down version of the loop I'm running,
there are lot of other IF's & Do__Loop statements in
there, and I have them running as efficiently as possible.

'------------------------------------------------------

openfile = strDir & strBureau & "\XND.CSV"
Filehandle = FreeFile()

Open openfile For Input As #Filehandle

Do
Line Input #Filehandle, strData

If Mid(strData, 2, 1) = "A" Then
varkWh(1) = Mid(strData, 71, 8)
varkWh(2) = Mid(strData, 55, 13)
varkWh(3) = Mid(strData, 82, 30)
End If

'CAN i PUT A LINE HERE TO RELEASE MEMORY

Loop Until EOF(1)
'------------------------------------------------------




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Way to free memory as I input lines from a file?

Hi Steven;

You can use a text driver to query the CSV file for the
exact information you want. Look at this link


http://4guysfromrolla.com/webtech/030899-1.shtml

Thanks,

Greg
-----Original Message-----
Hi,

I have some code where I open a very large file into
memory then enter a loop where I input each line one by
one, analyse it & draw data from it depending on certain
criteria.

The file being opened is 216,000 lines long and when the
code is running it just seems to get slower and slower
the further down the file it gets.

My question is, can I speed it up? I'm no expert, but
what I presume is happening is that Excel is, line by
line, opening more and more of the file into memory and
keeping it there. If that's the case, is there a way of
releasing the memory (of the lines) i no longer need?

I don't totally understand what the Filehandle & Freefile
things are, I just know that they work. In fact, would it
be quicker to use (Open openfile For Binary Access Read
As #Filehandle) & return data from the file that way?
(it's all the same place).

Any help on this would be greatly appreciated!

Thanks for your time,

Steven Douglas

Below is a very cut down version of the loop I'm running,
there are lot of other IF's & Do__Loop statements in
there, and I have them running as efficiently as possible.

'------------------------------------------------------

openfile = strDir & strBureau & "\XND.CSV"
Filehandle = FreeFile()

Open openfile For Input As #Filehandle

Do
Line Input #Filehandle, strData

If Mid(strData, 2, 1) = "A" Then
varkWh(1) = Mid(strData, 71, 8)
varkWh(2) = Mid(strData, 55, 13)
varkWh(3) = Mid(strData, 82, 30)
End If

'CAN i PUT A LINE HERE TO RELEASE MEMORY

Loop Until EOF(1)
'------------------------------------------------------




.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do I need a new PC? - Memory Error on 15000 lines of data wx4usa Excel Discussion (Misc queries) 2 July 24th 07 01:58 AM
input file with more than 250000 lines green1111 Excel Discussion (Misc queries) 2 April 26th 06 04:33 PM
Anyone know of a free add-in that monitors COM input? BenWars Excel Discussion (Misc queries) 0 October 15th 05 11:59 PM
Using different lines in an input- or msgbox Syrus the Virus[_16_] Excel Programming 3 March 2nd 04 12:35 PM
free up memory by deleting variables clui[_11_] Excel Programming 4 December 11th 03 01:10 AM


All times are GMT +1. The time now is 11:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"