title: VBA Word: Regex replace capture group does not highlight
body: <p>I cannot figure out why the code is not working. I want to find within a cell (XXX) regex match and highlight each occurrence. Tried a lot of things.</p>
  <pre class="lang-vb prettyprint-override"><code>    rangeFinding.SetRange Start:=rngStart.Start, End:=rngEnd.End
      rangeFinding.Select
      With Selection
          .Tables(1).cell(2, 2).Range.Text = y
      End With
      
      Dim qq As Range
      
      Set qq = GetCellTextRange(Selection.Tables(1).cell(2, 2))
      Options.DefaultHighlightColorIndex = wdYellow
      
      With qq.Find
          .ClearFormatting
          .Text = &quot;(\(*\))&quot;
          .MatchWildcards = True
          .Replacement.ClearFormatting
          .Replacement.Text = &quot;\1&quot;
          .Replacement.Highlight = True
      
          .Replacement.Font.Color = vbRed 
          .Execute Replace:=wdReplaceAll
      End With
       
      qq.HighlightColorIndex = wdYellow
  End If
  </code></pre>
  <p>Procedure that is called:</p>
  <pre class="lang-vb prettyprint-override"><code>Function GetCellTextRange(cl As cell) As Range ' ' GetCellTextRange
      returns the content range of a table cell '
      Dim rng As Range
      Set rng = cl.Range
      rng.MoveEnd wdCharacter, -1
      Set GetCellTextRange = rng
  End Function
  </code></pre>
  <p>Changing font color and/or bold does work, however highlighting not. Even when I replace <code>\1</code> with <code>YYY</code> it works. But highlighting does not get applied, either when I use <code>.Replacement.Highlight</code> or alternative <code>qq.HighlightColorIndex = wdYellow</code>.</p>
  <p>BTW: does the <code>Find</code> (and its <code>Execute</code>) function adapt <code>qq</code> range? That is what I noticed, but the docs do not tell it clearly.</p>