Mark A Matte
markamatte at hotmail.com
Fri Aug 4 13:50:32 CDT 2006
Drew, Thanks for the code...I'm getting an error on the OPEN line when I execute...error="Bad file name or number" I even shortened the name to less than 8 characters...no spaces, just letters. Any ideas? Thanks, 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: Re: [AccessD] Edit Large text file via VBA >Date: Fri, 4 Aug 2006 13:10:33 -0500 > >Dim f as long >Dim strTemp as string >F=freefile >Open "C:\PathToFile\FileName.txt" for binary access read as f >Strtemp=space(lof(f)) >Get f,,strtemp >Close f >Strtemp=replace(strtemp,"WhateverCharactersYouWantToReplace","") >F=freefile >Open "C:\NewFile.txt" for binary access write as f >Put f,,strtemp >Close f > > >If you just want to replace the original file, I recommend using the kill >statement to delete the old file, then change the path of the last 'open' >statement to rewrite it. If you 'write' a file that is smaller then the >one >you are writing over, you'll get the remainder at the end. > >Drew > >-----Original Message----- >From: Mark A Matte [mailto:markamatte at hotmail.com] >Sent: Friday, August 04, 2006 1:02 PM >To: accessd at databaseadvisors.com >Subject: [AccessD] Edit Large text file via VBA > >Hello All, > >I know someone helped me do this a couple of years ago...but I can't find >it > >in my stuff or the archives. > >I need to search a large pipe delimited text file and remove a string of >characters. I'm sure I opened it in vba and did this 'search/edit' >thing...but not sure where to start. > >Also...importing it is not an option due to the one of ther characters I >need to delete. > >any ideas? > >Thanks, > >Mark A. Matte > > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com