DWUTKA at marlow.com
DWUTKA at marlow.com
Fri Aug 4 13:10:33 CDT 2006
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