title: How to replace Fields in Word document with their content using VBA?
body: <p>Some sites use textarea to publish code in articles. If someone copy/paste the article in Word, it shows empty textarea with scrollbars and below the code in a table with numbered lines.<br />
  I want to replace it with just code (or with just the table, which I can successfully convert to text), by removing the textarea.</p>
  <p>Did try to do it like this</p>
  <pre class="lang-vb prettyprint-override"><code>Sub RemoveTextBoxes()     
      Dim oFld    As Word.FormField
       
      With Application.ActiveDocument
          ' \\ TextInput Type requires to unprotect the document
          If .ProtectionType &lt;&gt; wdNoProtection Then .Unprotect
           
          ' \\ Loop all formfields in active document
          For Each oFld In .FormFields()
               
              ' \\ Only remove Formfield textboxes that have textinput only
              If oFld.Type = wdFieldFormTextInput And oFld.TextInput.Type = wdRegularText Then
               
                  ' \\ Delete
                  oFld.Delete
              End If
          Next
           
          ' \\ Reprotect the document
          .Protect wdAllowOnlyFormFields, True
      End With  
  End Sub
  </code></pre>
  <p>If I press Alt+F9 (displays field codes) I do see now</p>
  <pre><code>{ HTMLCONTROL Forms.HTML :TextArea.1 } 
  </code></pre>
  <p>above the text box with scrollbars! If I close and open up again, it's still here.</p>
  <p>How do I get this TextArea content and remove|replace the element with the content?</p>