title: Add a shape to a slide and format that
body: <p>I am trying to make my vba script below to add annotation notes to powerpoint slides. The idea is that the script can be used to add "to-be-checked notes" to slides. Hence, I've got it set up in a little add-in that displays a menu so adding the TBC, TBU, TBD notes are added.
  The sub is showing errors from time to time and does not always fully do its job (i guess because of the part where I wrote in my code:</p>
  
  <pre><code>ActiveWindow.Selection.SlideRange.Shapes("Rectangle 4").Select
  </code></pre>
  
  <p>Can anyone assist me how do make the script bulletproof. A short explanation of the approach would be great. That way I can learn how do things right in the future.</p>
  
  <p>Best,</p>
  
  <h2>eltiburon</h2>
  
  <p>This is what my entire script so far looks like:</p>
  
  <pre><code>Sub InsertShape_TBC()
  
  ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 575.5, 9.12, 124.75, 34.12).Select
  With ActiveWindow.Selection.ShapeRange
      .Fill.Visible = msoTrue
      .Fill.Solid
      .Fill.ForeColor.RGB = RGB(162, 30, 36)
      .Fill.Transparency = 0#
      .Line.Visible = msoFalse
  End With
  ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
  ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select
  With ActiveWindow.Selection.TextRange
      .Text = "[TBC]"
      With .Font
          .Name = "Arial"
          .Size = 18
          .Bold = msoFalse
          .Italic = msoFalse
          .Underline = msoFalse
          .Shadow = msoFalse
          .Emboss = msoFalse
          .BaselineOffset = 0
          .AutoRotateNumbers = msoFalse
          .Color.SchemeColor = ppForeground
      End With
  End With
  ActiveWindow.Selection.SlideRange.Shapes("Rectangle 4").Select
  ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
  ActiveWindow.Selection.SlideRange.Shapes("Rectangle 4").Select
  ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
  ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=6).Select
  ActiveWindow.Selection.TextRange.Font.Bold = msoTrue
  ActiveWindow.Selection.TextRange.Font.Color.RGB = RGB(Red:=255, Green:=255, Blue:=255)
  ActivePresentation.ExtraColors.Add RGB(Red:=255, Green:=255, Blue:=255)
  ActiveWindow.Selection.Unselect
  End Sub
  </code></pre>