Changing Information in Multiple Documents
As you use Word, day in and day out, you tend to accumulate lots and lots of documents. If these documents are used for a standard purpose, it is not unusual for the documents to contain some of the same information.
For instance, you may have documents that contain stories that you submit to different newspapers and magazines. While the individual stories may be different, each document may contain your name and contact information. If your contact information changes, or if you decide to use a different spelling for your name, you may long for a way to do a universal change to all the documents at once.
Unfortunately, Word does not include this type of capability. Your options are either to rely on a third-party solution or write your own macro to do the changes. There are a number of third-party programs that offer the type of search-and-replace function necessary when working with multiple documents. The following are just a few of the ones suggested by WordTips subscribers:
Word developer Malcom Smith has also created a macro that will perform search and replaces across directories. If you want to see it, you can visit http://www.dragondrop.com. Just click the Find and Replace for Word link, at the right side of the page.
If you don't mind using your own macros, the following shows the techniques inherent in stepping through the documents in a particular folder.
Public Sub MassReplace()
.LookIn = "C:\" ' where to search
.SearchSubFolders = True ' search the subfolders
.FileName = "*.doc" ' file pattern to match
' if more than one match, execute the following code
If .Execute() > 0 Then
' for each file you find, run this loop
For i = 1 To .FoundFiles.Count
' open the file based on its index position
' search and replace the address
.Text = "OldAddress"
.MatchCase = True
.Replacement.Text = "NewAddress"
' replace e-mail address
.Text = "Oldemail"
.Replacement.Text = "Newemail"
' save and close the current document
' if the system cannot find any files
' with the .doc extension
MsgBox "No files found."
This macro is quite powerful, and it allows you to not just change a street address, but also your e-mail address. All you need to do is make changes to specify which directory and drive to use in your search, as well as what the old and new information is. Change the .Lookin parameter early in the macro to indicate where the macro should search; make sure you use a full path. Then, within the main body of the macro, update the .Text and .Replacement.Text parameters to reflect what you are searching for and replacing with.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (3783) applies to Microsoft Word 97, 2000, 2002, and 2003.
Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!
Leave your own comment:
Comments for this tip:
Ragavendra 13 Jan 2016, 04:17
Above is a nice code to do the job, but for non technical users, there is a demo in youtube about a tool
watch this demo
kamalhaider 12 Dec 2015, 10:24
(1) The SQA methodology that should be implemented for this project includes following:
System testing in which the entire system is tested for errors and bugs. This testing is listed under the black-box testing method, where the software is checked for user-expected working conditions as well as potential exception and edge conditions.
Software reliability testing is a field of software testing that relates to testing software’s ability to function, given environmental conditions, for a particular amount of time, thus it must be implemented for this project.
Apart from system testing and reliability testing, performance testing is also required to be executed for this project which is a type of non-functional testing it helps in the measurement of how a system behaves under an increasing load and thus how it ensures reliability.
Sharon 17 Jul 2015, 00:10
Here's the correct Wordfisher link:
It only works up to Word 2003, however.
InfoRapid cannot replace text in Word docs, just find.
Malcolm Smith's macro is gone as is the whole website apart from the landing page.
The rest are all paid commercial software.
sid 20 May 2015, 03:28
user can use a software for find and change word in several word document.
ben 28 Mar 2015, 04:29
is it possible to run the code from a add-in inside word it self? - for a multiple docs.
Carol 16 Mar 2015, 07:59
I need to 'find and replace' multiple words in a Word doc. I type the same words over and over, so to save time, and my fingers, I'd like to have a list of words, for example, pp for people, "a" for and, "sat" for satisfactory, etc. So I type those short forms and at the end, I want to replace each one with the proper word. But not one by one, all of them.
Anyone got any ideas?
G Prasanth Kumar 12 Mar 2015, 09:21
This information helps a lot.
Apart from this I am looking the possibilities to do changes to a word file with dotm extension, and save it as docx file in Ubuntu through a cronjob.
Is there any option to do this?
sukesh 19 Feb 2015, 12:08
if we have to open one word file we have to copy the that matter in another word file .if we modify the first word file automatically modify the second word .is it is posssible but i will forget theprocedure
Jennifer 16 Feb 2015, 09:35
Thank you Mr Wyatt for saving me hours of work. I have Just used your link to download a find and replace program. Loved loved loved it, so easy to use and hours of work done in 6 minutes.....move over sliced bread!
(by the way one of the links doesn't work)
Sukhvinder 12 Sep 2014, 09:47
Thanks a lot!!!!
Jignesh Pandya 23 Apr 2014, 10:49
I want to extract name of my pdf files from particular folder number of files are very high
Jon 22 Apr 2014, 07:38
Thanks for the kind offer William but the job is done now.
William 12 Apr 2014, 10:57
Hey, I wrote a simple terminal app in java to change the header on multiple word docs at once. Shoot me an email if you are interested
William 12 Apr 2014, 10:55
I wrote my friend a command line java utility to change the header on multiple word documents in a folder. Its bare bones, but gets the job done. Shoot me an email if you are interested and i can email it precompiled
Jon 13 Feb 2013, 05:46
I did find various codes to do this but none seemed perfect for what I needed to do which was change an address in the headers of loads of document templates. As the existing addresses could vary slightly, the find/replace didn't work and when it did, the format was sometimes wrong.
I don't know if this works for what you want to do but this is how I did it: I opened a new document and made the header exactly as I wanted it to be. Then opened a document that needed to be changed (make sure that these are the only two Word docs open). Then I went back to the new doc and recorded a macro in it that copies the new header, opens the second document, deletes the entire header and copies in the new header and alters the format (just in case). When it has finished, do a save-as. So when I come across a template that needs changing, I open the doc with the macro in it, run the macro and the job's done. Hope that helps
Emily 13 Feb 2013, 00:33
I same issue John, let me know if you find a solution!
Jon 27 Sep 2012, 05:09
This code is great and works perfectly for replacing text in the body of my Word documents. The trouble is that the text I want to replace is in the document header and this code does not look there. Do you have the code to find/replace in the header please?