title: EDIT TEXT disabled on shapes in protected VBA worksheet
body: <p>I have a heavily protected worksheet that uses VBA to dynamically create shapes.  The shapes are created, unlocked then the worksheet is reprotected. Here is a snippet for a textbox shape:</p>
  
  <pre><code> Private Sub cmdTextBox_Click()
      Dim Shp As Shape
      Dim X, Y, Side As Single
  
      X = ActiveSheet.Range("D12").Left
      Y = ActiveSheet.Range("D12").Top
  
      ActiveSheet.Unprotect
  
      Set Shp = ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, X, Y, 250, 30)
      Shp.Name = "textbox_" &amp; ActiveSheet.Shapes.Count
  
      Set Shp = ActiveSheet.Shapes("textbox_" &amp; ActiveSheet.Shapes.Count)
      Shp.TextFrame.Characters.Font.Name = "Arial"
      Shp.TextFrame.Characters.Font.Size = "16"
      Shp.Fill.BackColor.RGB = RGB(255, 255, 0)
      Shp.Fill.Transparency = 0.2
      Shp.Line.Transparency = 1
      Shp.TextFrame.HorizontalAlignment = xlHAlignCenter
      Shp.TextFrame.VerticalAlignment = xlVAlignCenter
      Shp.TextFrame.Characters.Font.ColorIndex = 1
      Shp.TextFrame.Characters.Font.Bold = True
      Shp.TextFrame.Characters.Text = "Right-click to modify format"
      Shp.Locked = False
  
      ActiveSheet.Protect
  
    End Sub
  </code></pre>
  
  <p>This allows the user to (among other shape creation tools) create some shapes on a diagram sheet.  My issue is that the protected workbook (I want to limit the user to specifically what my dialogs allow them to place/enter for data) disables the "EDIT TEXT" option of any type of shape.  How do I either </p>
  
  <p>A) Enable the "EDIT TEXT" option for unlocked shapes or... (preferred)</p>
  
  <p>B) Detect that a shape has been selected (each shape is created with a name prefix like rect_ or circle_ for easy .name identification) in order to know when to unprotect the sheet to enable the "EDIT TEXT" option and then re-protect upon deselection or selection of something else? (slightly less desireable) </p>