How to search and replace across multiple files in Word?
If you have dozens of Word files containing the same content (like headers, footers, or specific text), and you need to replace this content across all documents, doing it manually can be tedious. This tutorial introduces two methods to quickly replace the same or different content across multiple Word documents at once.
Find and replace texts across multiple Word documents at the same time with VBA code
Easily find and replace different texts across multiple documents at the same time with Kutools for Word
Find and replace texts across multiple Word documents at the same time with VBA code
This method shows how to use VBA code to search for and replace content across multiple documents simultaneously.
- Press Alt + F11 to open the Microsoft Visual Basic for Applications window.
- Click "Insert" > "Module", then paste the following code:
Sub CommandButton1_Click() 'Updated by Extendoffice 20180625 Dim xFileDialog As FileDialog, GetStr(1 To 100) As String Dim xFindStr As String Dim xReplaceStr As String Dim xDoc As Document On Error Resume Next Set xFileDialog = Application.FileDialog(msoFileDialogFilePicker) With xFileDialog .Filters.Clear .Filters.Add "All WORD File ", "*.docx", 1 .AllowMultiSelect = True i = 1 If .Show = -1 Then For Each stiSelectedItem In .SelectedItems GetStr(i) = stiSelectedItem i = i + 1 Next i = i - 1 End If Application.ScreenUpdating = False xFindStr = InputBox("Find what:", "Kutools for Word", xFindStr) xReplaceStr = InputBox("Replace with:", "Kutools for Word", xReplaceStr) For j = 1 To i Step 1 Set xDoc = Documents.Open(FileName:=GetStr(j), Visible:=True) Windows(GetStr(j)).Activate Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = xFindStr .Replacement.Text = xReplaceStr .Forward = True .Wrap = wdFindAsk .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ActiveDocument.Save ActiveWindow.Close Next Application.ScreenUpdating = True End With MsgBox "Operation end, please view", vbInformation End Sub
- Press F5 to run the code.
- In the Browse window, select the documents you want to process, then click "OK".
- In the "Find what" input box, enter the word or phrase to find and click "OK".
- In the "Replace with" input box, enter the replacement text and click "OK".
- Click "OK" in the final Microsoft Word dialog box.
All instances of the specified text in the selected Word files will be replaced at once.
Easily find and replace different texts across multiple documents at the same time with Kutools for Word
The "Batch Find and Replace" feature in Kutools for Word lets you search and replace multiple text items across several Word documents at once.
- Click "Kutools" > "Batch Replacement".
- In the Batch Find and Replace dialog, configure the settings:
- Click the "Add Row" button.
- In the new row:
- Enter the text to find under "Find".
- Enter the replacement text under "Replace".
- Optionally, specify a search type, location where to find and replace, highlight color, and other options as needed in the respective columns.
- Click the
button in the "File Type" section to add Word files to the batch.
- Click "Replace" or "Find". Tip: Repeat steps 1) and 2) to add more find-and-replace rules.
- Close the Batch Find and Replace dialog when done.
Notes:
- If you click "Find", the matches will appear under the "Preview Result" tab. To apply replacements afterward, switch back to the "Find and Replace" tab.
- If you click "Replace", all matches are immediately replaced and shown under "Preview Result".
- If highlight colors were specified, the replacements in your Word documents will be color-coded accordingly.
For more information about the "Batch Find and Replace" feature, view the tutorial page.
Best Office Productivity Tools
Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!
π€ Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish (Preserve Format) / Super Translate (Preserve Format) / AI Redaction / AI Proofread...
π Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/HTML...) / Batch Convert to PDF...
β Contents Editing: Batch Find and Replace across Multiple Files / Resize All Pictures / Transpose Table Rows and Columns / Convert Table to Text...
π§Ή Effortless Clean: Sweap away Extra Spaces / Section Breaks / Text Boxes / Hyperlinks / For more removing tools, head to the Remove group...
β Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / Multiple Pictures / Discover more in the Insert group...
π Precision Selections: Pinpoint Specific Pages / Tables / Shapes / Heading Paragraphs / Enhance navigation with more Select features...
β Star Enhancements: Navigate to Any Location / Auto-Insert Repetitive Text / Toggle Between Document Windows / 11 Conversion Tools...
π Supports 40+ Languages: Use Kutools in your preferred language β supports English, Spanish, German, French, Chinese, and 40+ others!

β¨ Kutools for Office β One Installation, Five Powerful Tools!
Includes Office Tab Pro Β· Kutools for Excel Β· Kutools for Outlook Β· Kutools for Word Β· Kutools for PowerPoint
π¦ Get all 5 tools in one suite | π Seamless integration with Microsoft Office | β‘ Save time and boost productivity instantly
Best Office Productivity Tools
Kutools for Word - 100+ Tools for Word
- π€ Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish / Super Translate / AI Redaction / AI Proofread
- π Document Mastery: Split Pages / Merge Documents / Batch Convert to PDF
- β Contents Editing: Batch Find and Replace / Resize All Pictures
- π§Ή Effortless Clean: Remove Extra Spaces / Remove Section Breaks
- β Creative Inserts: Insert Thousand Separators / Insert Check Boxes / Create QR Codes
- π Supports 40+ Languages: Kutools speaks your language β 40+ languages supported!