Question: wrote this macros for word to do a find replace on multiple files. trying to do it so it : 1. Can do do what

wrote this macros for word to do a find replace on multiple files. trying to do it so it :

1. Can do do what it already does(Find and replace on multiple files)

AND

2. also find and replace multiple values at the same time.

I want to run this on word microsoft.

Sub GlobalFindAndReplace() 'Set Vairables Dim WordToFind As String Dim WordToReplace As String 'Set word to find as input from user WordToFind = InputBox("What is the word you wish to find and replace?", "Word to find") 'Check that word to find is not blank If WordToFind = "" Then Exit Sub 'Set word to replace as input from user WordToReplace = InputBox("What is the word you wish to use as replacement?", "Word to find") 'Check that word to find is not blank If WordToReplace = "" Then Exit Sub 'Loop Every Open Document For Each Doc In Application.Documents Doc.Content.Select With Selection.Find .Forward = True .Wrap = wdFindStop .Text = WordToFind .Execute End With With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = WordToFind .Replacement.Text = WordToReplace .Forward = True .Wrap = wdFindContinue .Format = False 'Set the below to true or false as per your requirements .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False 'Set the above to true or false as per yout requirements On Error Resume Next .Execute Replace:=wdReplaceAll End With Next 'Display a message box to let the user know the task has been completed MsgBox "Completed" End Sub

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!