[AccessD] FW: Edit Large text file via VBA

Mark A Matte markamatte at hotmail.com
Mon Aug 7 09:59:14 CDT 2006


Thanks Drew...but I'm kinda lost on this part:

>In this example, it just keeps reading chunks (512 bytes (or characters) at
>a time).  You can be writing to a new file at the same time, just need a
>different variable to represent the NewFile pointer.

I know I need to do this...but I would have to do it within the loop...and 
can I have to files open at the same time?

Thanks,

Mark


>From: DWUTKA at marlow.com
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: accessd at databaseadvisors.com
>Subject: [AccessD] FW:  Edit Large text file via VBA
>Date: Fri, 4 Aug 2006 16:28:25 -0500
>
>You can use the same code, but 'chunk' the read...
>
>
>
>The get statement retrieves the amount of data available in the strTemp
>variable, ie:
>
>
>
>strTemp=Space(lof(f))
>
>get f,,strTemp
>
>
>
>in the first line, it is setting strtemp as a string (of spaces) the length
>of the file (lof statement, f being the file pointer).
>
>
>
>The get statement can be used to read portions of the file.  By default, it
>keeps reading through, for example:
>
>
>
>Dim f as Long
>
>Dim intBufferSize As Long
>
>Dim strTemp as string
>
>Dim intSpaceRemaining as Long
>
>intBufferSize=512
>
>F=freefile
>
>Open "C:\YourTextFile.txt" for binary access read as f
>
>intSpaceRemaining=lof(f)
>
>do until intspaceremaining=0
>
>       if intBuffersize>intSpaceRemaining then
>intBuffersize=intSpaceRemaining
>
>       strTemp=Space(intBuffersize)
>
>       get f,,strTemp
>
>       strTemp=Replace(strTemp,"YourCharacters","")
>
>       intspaceremaining=intspaceremaining-intbuffersize
>
>loop
>
>close f
>
>
>
>
>
>In this example, it just keeps reading chunks (512 bytes (or characters) at
>a time).  You can be writing to a new file at the same time, just need a
>different variable to represent the NewFile pointer.
>
>
>
>Drew
>
>
>
>-----Original Message-----
>From: Mark A Matte [mailto:markamatte at hotmail.com]
>Sent: Friday, August 04, 2006 3:25 PM
>To: accessd at databaseadvisors.com
>Subject: Re: [AccessD] Edit Large text file via VBA
>
>
>
>Thanks again Drew.
>
>
>
>I might have forgotten to mention that these are farely LARGE text files.
>
>The one it is crashing on is 138 mb ...error= "Out of String Space"
>
>
>
>Any other ideas?
>
>
>
>Thanks again,
>
>
>
>Mark A. Matte
>
>
>
>P.S...  The largest is just over 150 mb
>
>
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com





More information about the AccessD mailing list