DWUTKA at marlow.com
DWUTKA at marlow.com
Fri Aug 4 16:28:25 CDT 2006
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