How to find and replace multiple words at the same time in a Word document?
Word provides a Find and Replace function to find all instances of a word or phrase and replace them with a new word at the same time. But if you want to find and replace different words at the same time, this build-in function can’t help. In this article, we are talking about a VBA method to find and replace multiple different words at the same time in Word document.
Please do as follows to find and replace multiple word at the same time in a Word document.
1. Open the Word document you want to find and replace multiple words at the same time, then press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, click Insert > Module. Then copy below VBA code into the Module window.
VBA code: Find and replace multiple words at the same time in Word
Sub FindAndReplaceMultiItems() 'Update by ExtendOffice 2018/10/25 Dim xFind As String Dim xReplace As String Dim xFindArr, xReplaceArr Dim I As Long Application.ScreenUpdating = False xFind = InputBox("Enter items to be found here,seperated by comma: ", "Kutools for Word") xReplace = InputBox("Enter new items here, seperated by comma: ", "Kutools for Word") xFindArr = Split(xFind, ",") xReplaceArr = Split(xReplace, ",") If UBound(xFindArr) <> UBound(xReplaceArr) Then MsgBox "Find and replace characters must be equal.", vbInformation, "Kutools for Word" Exit Sub End If For I = 0 To UBound(xFindArr) Selection.HomeKey Unit:=wdStory With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = xFindArr(I) .Replacement.Text = xReplaceArr(I) .Format = False .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll Next Application.ScreenUpdating = True End Sub
3. Press the F5 key to run the code.
4. In the first Kutools for Word dialog box, enter the multiple words you will find and replace into the textbox, and separate them with comma, then click the OK button. See screenshot:
5. In the second Kutools for Word dialog box, enter the new words you will replace with (these words also need to be separated by commas), and then click the OK button.
Note: In this case, all “KTE” in this document will be replaced with “New”, and “KTO” and “KTW” will be replaced with “Test” and “Finish”. Please change them to your needs.
1. Launch the Microsoft Word application, click Kutools Plus > Batch Find and Replace.
2. In the Batch Find and Replace window, please configure as follows.
- 2.1 click the button > Add File or Add Folder to add one or more documents in which you will find and replace multiple words.
- 2.2 Click the Add row button to insert the find and replace fields. If you want to find and replace three different texts at the same time, please create three rows.
- 2.3 In each row, enter the existing words you will replace with a new one in the Find column, and then enter the new words into the Replace column.
- 2.4 Specify the Search Type for each row.
- 2.5 In the Find in column, choose where to apply the find and replace. It includes Main document, Header and Footer in this section. You can choose one of them, two of them or all of them based on your needs.
- 2.6. Click the Replace button to start the operation. See screenshot:
Then the specific words are replaced in selected documents at the same time.
Tip: You can highlight the result with background color by specifying certain color in the Highlight column for a row.
Recommended Word Productivity Tools
- Complicated and repeated operations can be done one-time processing in seconds.
- Insert multiple images across folders into Word document at once.
- Merge and combine multiple Word files across folders into one with your desired order.
- Split the current document into separate documents according to heading, section break or other criteria.
- Convert files between Doc and Docx, Docx and PDF, collection of tools for common conversions and selection, and so on...