title: "Rich text controls cannot be applied here" when trying to add multiple nested content controls
body: <p>I have a VSTO word add-in which is supposed to let the user add potentially nested content controls at/around the current selection.  I am having difficulty getting content controls to be added, even under circumstances when I think they should be able to be added.</p>
  
  <p>The following VBA code replicates one of the issues on a blank document:</p>
  
  <pre><code>Public Sub DoTest()
      AddControls "Test"
      AddControls "Test2"
      Application.Selection.MoveRight WdUnits.wdCharacter
      Application.Selection.MoveRight WdUnits.wdCharacter
      Application.Selection.TypeText " "
      AddControls "Test3"
      AddControls "Test4" 'ERROR: "Rich text controls cannot be applied here"
  End Sub
  
  Public Sub AddControls(ByVal name As String)
      Dim richTextControl1 As ContentControl
      Set richTextControl1 = Application.ActiveDocument.ContentControls.Add(wdContentControlRichText)
  
      richTextControl1.Tag = name
      richTextControl1.Title = name
      richTextControl1.SetPlaceholderText , , " "
  
      Application.Selection.SetRange richTextControl1.Range.Start, richTextControl1.Range.End
  End Sub
  </code></pre>
  
  <p>At the point that the test errors out, the selection range starts at 6 and ends at 7 (which is the same range for the "Test3" rich text content control).  What am I doing incorrectly here?</p>
  
  <p>I understand that the <code>Test</code> and <code>Test2</code> controls are surrounding the paragraph when they are created (denoted by the content controls being white), and that the <code>Application.Selection.TypeText " "</code> instruction outside of the content controls causes <code>Test</code> and <code>Test2</code> to be pulled inside of the paragraph (denoted by the content controls turning grey).  When <code>Test3</code> is created it is also inside of the paragraph. This can be verified by saving the document as XML and reading through the file in your favorite text editor.</p>
  
  <p>I can work around the issue by typing a space inside of the parent content control before adding a child content control, and then deleting the space after.  However, this forces the child content control to always be inside of a paragraph (as a "grey" control).  This is not acceptable, as the user needs to be able to insert tables inside of the content controls (which is not possible if the content control is inside of a paragraph, since paragraphs cannot contain tables)</p>