title: Find and Replace Multiple Text Strings on Multiple Text Files from a folder
body: <p>I'm working on the vba code to accomplish the following tasks</p>
  
  <ol>
  <li>Word Document Open a Text file from the folder</li>
  <li>Find and replace the text (multiple Text) based on a excel sheet (which have find what and replace with)</li>
  <li>Process all text files in the folder and save it.</li>
  </ol>
  
  <p>I would like to customize the below code for the above requirement, </p>
  
  <p>I'm using Office 2016 and I think I have to replace Application.FileSearch in the script to ApplicationFileSearch for 2003 and prior office editions.</p>
  
  <p>I try to accomplish using the word macro recorder and also used notepad++, I've recorded in Notepad++ also and it works for one file, I would like to do batch process all files in the folder and save it after replacing the text. </p>
  
  <p>As there is too many lines there to replace more than 30 or more lines to replace, I would like the code to look for the text from a excel file like find what and replace with columns.</p>
  
  <pre><code> Sub FindReplaceAllDocsInFolder( )
   Dim i As Integer
   Dim doc As Document
   Dim rng As Range
  
   With Application.FileSearch
  .NewSearch
  .LookIn = "C:\My Documents"
  .SearchSubFolders = False
  .FileType = msoFileTypeWordDocuments
  If Not .Execute( ) = 0 Then
      For i = 1 To .FoundFiles.Count
           Set doc = Documents.Open(.FoundFiles(i))
              For Each rng In doc.StoryRanges
               With rng.Find
                  .ClearFormatting
                  .Replacement.ClearFormatting
                  .Text = "Dewey &amp; Cheatem"
                  .Replacement.Text = "Dewey, Cheatem &amp; Howe"
                  .Forward = True
                  .Wrap = wdFindContinue
                  .Format = False
                  .MatchCase = False
                  .MatchWholeWord = False
                  .MatchWildcards = False
                  .MatchSoundsLike = False
                  .MatchAllWordForms = False
                  .Execute Replace:=wdReplaceAll
               End With
              Next rng
           doc.Save
           doc.Close
  
           Set rng = Nothing
           Set doc = Nothing
      Next i
  Else
      MsgBox "No files matched " &amp; .FileName
  End If
   End With
   End Sub
  </code></pre>
  
  <p>Thanks
  Jay</p>