title: Select the result of replacement - Word Macro
body: <p>I want to get and select the result of a find and replacement macro and do some operations on it. </p>
  
  <p>Say, this is the text: ‎<code>\[abc\]‎</code>, I want to convert it to <code>abc</code> and then select <code>abc</code>.</p>
  
  <p>Here is the code:</p>
  
  <pre class="lang-vb prettyprint-override"><code>    Selection.Find.ClearFormatting
      Selection.Find.Replacement.ClearFormatting
      With Selection.Find
          .Text = "(\\\[)(*)(\\\])"
          .Replacement.Text = "\2"
          .Forward = True
          .Wrap = wdFindContinue
          .Format = False
          .MatchCase = False
          .MatchWholeWord = False
          .MatchKashida = False
          .MatchDiacritics = False
          .MatchAlefHamza = False
          .MatchControl = False
          .MatchAllWordForms = False
          .MatchSoundsLike = False
          .MatchWildcards = True
      End With
      Selection.Find.Execute Replace:=wdReplaceAll
      Selection.Cut
  </code></pre>
  
  <p>Here in the last line, <code>Selection.Cut</code> gives an error that the Selection is empty.
  I want to select the output of the replacement and Cut it.</p>
  
  <p>From my repository <a href="https://github.com/aminya/Amin-MSWord-VBA-macros" rel="nofollow noreferrer">Amin MSWord VBA macros</a></p>