ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA - open text file, replace text, save file? (https://www.excelbanter.com/excel-programming/312110-excel-vba-open-text-file-replace-text-save-file.html)

Cybert

Excel VBA - open text file, replace text, save file?
 
I have a spreadsheet with 287 rows.

Column 1 is a short text string. (string1)
Column 2 is a slightly different text string. (string2)

I need to search through approximately 25,000 short text files (in a
variety of different folders) and REPLACE all occurences of string1
with string2.

Can I [fairly easily] write a VBA routine to do this automatically?
It's going to take me DAYS to make all the changes by hand. If I
can't do it with Excel is there another tool that would do the trick?

christian

Excel VBA - open text file, replace text, save file?
 

I used this yesterday for word docs but don't see why it wouldn't wor
for Excel. Let me know either way.

http://word.mvps.org/FAQs/MacrosVBA/BatchFR.ht

--
christia

-----------------------------------------------------------------------
christian's Profile: http://www.excelforum.com/member.php...fo&userid=1436
View this thread: http://www.excelforum.com/showthread.php?threadid=26532


Dave Peterson[_3_]

Excel VBA - open text file, replace text, save file?
 
I think the most difficult part is gonna be specifying those 25,000 text files.

If you can do that (maybe a list in column A of another worksheet???), you could
loop through those files and run a macro based on the code in this thread:

http://google.com/groups?threadm=1f5...0a %40phx.gbl



Cybert wrote:

I have a spreadsheet with 287 rows.

Column 1 is a short text string. (string1)
Column 2 is a slightly different text string. (string2)

I need to search through approximately 25,000 short text files (in a
variety of different folders) and REPLACE all occurences of string1
with string2.

Can I [fairly easily] write a VBA routine to do this automatically?
It's going to take me DAYS to make all the changes by hand. If I
can't do it with Excel is there another tool that would do the trick?


--

Dave Peterson



All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com