title: Looping through a Word Document and Replacing a String with PageBreak
body: <p>I want to replace every occurrence of the string "#PAGEBREAK# with an actual <code>pagebreak</code>. This is what I came up with:</p>
  
  <pre><code>Sub InsertPageBreak()
  
      Application.ScreenUpdating = False
      With ActiveDocument.Range
          With .Find
              .ClearFormatting
              .Replacement.ClearFormatting
              .Text = "#PAGEBREAK#"
              .Replacement.Text = ""
              .Forward = True
              .Wrap = wdFindContinue
              .Format = True
              .InsertBreak Type:=wdPageBreak
              .Execute
          End With
      End With
      Application.ScreenUpdating = True
  
  End Sub
  </code></pre>
  
  <p>What actually happens: The string "#PAGEBREAK#" is exchanged for an empty string. The .Find works as intended but I get the error message: </p>
  
  <blockquote>
    <p>Method or Object not found</p>
  </blockquote>
  
  <p>on the </p>
  
  <pre><code>.InsertBreak Type:= wdPageBreak
  </code></pre>
  
  <p>What methods could be used here in which way?</p>