title: Changing the Text of a Grouped TextBox
body: <p>The animation below depicts the manual change of a text inside a <code>TextBox</code> AFTER the <code>TextBox</code> has been grouped with another shape ( an <code>msoShapeOval</code> ).</p>
  <p><a href="https://i.stack.imgur.com/P0IsB.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P0IsB.gif" alt="enter image description here" /></a></p>
  <p>Q: How to perform the same task in VBA ?</p>
  <p>I tried the following code - it groups the two shapes correctly but after that it fails at the last line:</p>
  <pre><code>Sub ChangeTextAfterGrouping()
      Dim shp As Shape
      Dim tb As Shape
      Dim ShpArray() As Variant
  
      Set shp = ActiveSheet.Shapes.AddShape(msoShapeOval, 200, 40, 120, 70)
      Set tb = ActiveSheet.Shapes.AddTextBox(msoTextOrientationHorizontal, 235, 65, 50, 20)
      
      tb.TextFrame.Characters.Text = &quot;ABC&quot;    'Success
      
      ReDim ShpArray(1 To 2)
      ShpArray(1) = shp.Name
      ShpArray(2) = tb.Name
      
      ActiveSheet.Shapes.Range(ShpArray).Group
      
      tb.TextFrame.Characters.Text = &quot;XYZ&quot;    'Error        
  End Sub
  </code></pre>
  <p>Other people are reporting the same problem. See:<br>
  <a href="https://www.excelforum.com/excel-programming-vba-macros/388251-editing-text-in-text-box-grouped-within-a-trapezoid.html" rel="nofollow noreferrer">https://www.excelforum.com/excel-programming-vba-macros/388251-editing-text-in-text-box-grouped-within-a-trapezoid.html</a></p>