title: Word 2007 macro to automatically number items in a document
body: <p>I am trying to use a macro to find and replace some text in a Word 2007 document. I want to autoincrement a number in the replacement text every time the text is found.</p>
  
  <p>Text before:</p>
  
  <pre><code>The quick brown (??) fox jumps over (??) the (??) lazy dog
  </code></pre>
  
  <p>Desired text after:</p>
  
  <pre><code>The quick brown (1) fox jumps over (2) the (3) lazy dog
  </code></pre>
  
  <p>For some reason my code only replaces the first instance:</p>
  
  <pre><code>Sub SetRequirements()
      Dim myNumber As Integer
      myNumber = 1
  
      With ActiveDocument.Content.Find
          .ClearFormatting
          .Text = "(??)"
          Do While .Execute( _
              Replace:=wdReplaceOne, _
              ReplaceWith:="(" &amp; myNumber &amp; ")", _
              Forward:=True) = True
  
              myNumber = myNumber + 1
  
          Loop
      End With
  End Sub
  </code></pre>
  
  <p>Help?</p>