title: Find and replace multiple words in Word
body: <p>I really hope you guys can help, I feel like I've been struggling with what should be (and probably is) a really simple problem. I've written an app which creates a folder structure, copies in the relevant test documents based on user inputs, and populates the document header and test sheets with various variables. I have populated the template test documents with placeholders, ("replCustNo","replPrjNo","replCustRef" etc), some in the header, some in the body of the document. I can only seem to replace one word at a time, I can't find a way of listing all the references to find, then listing all the replacement variables. Seems like a very clumsy way of coding to have the find/replace over and over, or call on a sub for it. </p>
  
  <p>Forgive me if this is really basic, I'm very new to coding, I'd really appreciate some help! I'm using vb and office 365</p>
  
  <pre><code> Dim objWordApp As New Word.Application
      'Open an existing document.  
      Dim objDoc As Word.Document = objWordApp.Documents.Open(projFolder &amp; "SAT\2 HV Tests\Flash.doc")
  
      objWordApp.ActiveDocument.Sections(1).Headers(1).Range.Select()
      objWordApp.Selection.WholeStory()
      With objWordApp.Selection.Find
          .Text = "replPrjNo"
          .Replacement.Text = RefNo
          .Forward = True
      End With
      objWordApp.Selection.Find.Execute(Replace:=Word.WdReplace.wdReplaceAll)
  
      'Save and close the document  
      objDoc.Save()
      objDoc.Close()
      objDoc = Nothing
      objWordApp.Quit()
      objWordApp = Nothing
  </code></pre>