title: Replacing strings in Word through VB. Works on first string only
body: <p>I'm trying to replace a string in a Word .doc file using Visual Basic, Visual Studio 2012. This code works for the first line that contains <code>&lt;&lt;FileNumber&gt;&gt;</code>. What's the trick to make it work for the rest? Thanks.</p>
  
  <pre><code>    Dim oWord As Word.Application
      Dim oDoc As Word.Document
  
      oWord = CreateObject("Word.Application")
  
      oWord.Documents.Open(FileName:=System.AppDomain.CurrentDomain.BaseDirectory + "\" + txtReportFolder.Text + "\" + txtReportNumber.Text + "\Form A.doc")
      oWord.Documents("Form A.doc").Activate()
      oDoc = oWord.ActiveDocument
      Dim oRange = oDoc.Content
      oRange.Find.Execute(FindText:="&lt;&lt;FileNumber&gt;&gt;", ReplaceWith:=txtReportNumber.Text)
      oRange.Find.Execute(FindText:="&lt;&lt;OCode1&gt;&gt;", ReplaceWith:="488")
      oRange.Find.Execute(FindText:="&lt;&lt;Text&gt;&gt;", ReplaceWith:="Loss")
      oRange.Find.Execute(FindText:="&lt;&lt;EDP1&gt;&gt;", ReplaceWith:="16G2-M")
  </code></pre>