Way to free memory as I input lines from a file?
From: GJones (anonymous_at_discussions.microsoft.com)
Date: 09/02/04
- Next message: Nathalie: "Re: Excel 2000 to excel 2003"
- Previous message: ...Patrick: "Re: Invoking a workbook from a Fortran Program!"
- In reply to: Steven Douglas: "Way to free memory as I input lines from a file?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 2 Sep 2004 04:58:35 -0700
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)
>'------------------------------------------------------
>
>
>
>
>.
>
- Next message: Nathalie: "Re: Excel 2000 to excel 2003"
- Previous message: ...Patrick: "Re: Invoking a workbook from a Fortran Program!"
- In reply to: Steven Douglas: "Way to free memory as I input lines from a file?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|