[AccessD] FW: Edit Large text file via VBA

Mark A Matte markamatte at hotmail.com
Fri Aug 4 23:02:06 CDT 2006


Drew,
I am home already(having cool refreshing beverages)...thank you very much 
for the help...I will plug in your latest version Monday.  I hope you have a 
wonderful weekend!!!

Thanks again,

Mark A. Matte


>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:55:42 -0500
>
>
>
>________________________________________
>From: Drew Wutka
>Sent: Friday, August 04, 2006 4:28 PM
>To: 'Access Developers discussion and problem solving'
>Subject: FW: [AccessD] Edit Large text file via VBA
>
>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