title: word vba conditional find and replace
body: <p>I'm trying to get MSWord's vba to replace one word: "an" with "a(n)" if the next word is "---- ". I managed to write this, but it doesn't seem to work. Any ideas why? (I also need to do the same for the word "a" with the same condition as well, but couldn't get the first one done yet, so..)
  By the way, I don't have a set range, I need to scan all the document..</p>
  
  <pre><code>Sub Makro1()
  With Selection
    Set Rng = .Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "an"
      .Forward = True
      .Wrap = wdFindStop
      .MatchCase = False
      .MatchWholeWord = True
      .MatchWildcards = False
      .MatchSoundsLike = False
      .MatchAllWordForms = False
      .Execute
    End With
    Do While .Find.Found
      If Selection.Next(Unit:=wdWord, Count:=1) = "---- " Then
      .Find.Replacement.Text = "a(n)"
      End If
      .Find.Execute
    Loop
  
  End With
  
  End Sub
  </code></pre>