Changing Information in Multiple Documents

by Allen Wyatt
(last updated June 25, 2018)

9

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()
    With Application.FileSearch
        .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
                Documents.Open FileName:=.FoundFiles(i)

                ' search and replace the address
                selection.Find.ClearFormatting
                selection.Find.Replacement.ClearFormatting
                With selection.Find
                    .Text = "OldAddress"
                    .MatchCase = True
                    .Replacement.Text = "NewAddress"
                End With
                selection.Find.Execute Replace:=wdReplaceAll

                ' replace e-mail address
                With selection.Find
                    .Text = "Oldemail"
                    .Replacement.Text = "Newemail"
                End With
                selection.Find.Execute Replace:=wdReplaceAll

                ' save and close the current document
                ActiveDocument.Close wdSaveChanges
            Next i
        Else
            ' if the system cannot find any files
            ' with the .doc extension
            MsgBox "No files found."
        End If
    End With
End Sub

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.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Misbehaving Leader Dots

Leader dots can be a great formatting "flourish" to use in your documents. If the leader dots don't print out correctly, ...

Discover More

Linking Word Documents

Want to add one document to another document? You can do it by adding links, described in this tip.

Discover More

Setting Up Your Printer

Word allows you to take full advantage of the capabilities of your printer. Accessing those capabilities is done through ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (menu)

Deleting the Open Document File

Want to delete the document you are currently viewing? Word doesn't provide a way to do it, but you can use the macro in ...

Discover More

Sizing the Preview Pane

Some versions of Word allow you to resize your Preview Pane, others do not. Here is how to make your view larger.

Discover More

Copying Custom Properties

You can add custom properties to a document to help with all sorts of file management tasks. If you want to copy these ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is seven more than 6?

2018-07-12 08:51:16

Richard Peers

The function Application.FileSearch was removed after Office 2007, so the code on this page sadly no longer works.


2018-06-12 15:00:35

Rachel

Hi, Is it possible to change the Title property in several (hundreds) of Word documents? Unfortunately 350 documents started from one original ancestor and all of them kept the original Title property. Thanks!


2018-05-17 10:57:24

Manny Bhuta

Another option is to use a software to do this. We use https://www.officefindreplace.com, works great.


2017-11-28 09:44:46

Jake

Or you could just use this program, it's much, much simpler.

http://www.gmayor.com/document_batch_processes.htm


2017-11-03 16:46:11

pamusician

This macro was exactly what I was looking for. Thanks for sharing!


2017-04-23 18:28:49

SuitableSoftware

Hello,
I saw your information on editing multiple word documents at once. I have written a free program (.exe for windows and .app for mac) which allows users to edit the headers for multiple word documents at once, as long as the headers across all the documents have similar formatting. To download and learn more, go to https://suitablesoftware.wixsite.com/home
-SuitableSoftware


2017-01-20 11:46:47

RobinCB

FYI: http://www.dragondrop.com is no longer available.


2016-10-10 10:52:07

Joe

You can also use a 3rd party tool to do this sort of thing very easily. Try something like www.officefindreplace.com for a quick fix to all of your documents.


2016-09-27 22:12:11

Steve

Allen,
Thanks for the great tip, it was exactly what I was looking for!

Cheers!
-Steve


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.