title: Excel autosize text to fit shape
body: <p>I want to add some VBA to a multiple chart template to autosize  title text to fit textbox. This now runs, but doesn't make any changes to text box ...</p>
  
  <pre><code>Sub TextBox()
  
  Dim ws As Worksheet
  Dim shp As Shape
  
  ' loop through sheets in this workbook
   For Each ws In ThisWorkbook.Worksheets
   ' loop through Chartobjects in sheet
     For Each shp In ws.Shapes
  
      If shp.Type = msoTextBox Then
          With shp.TextFrame2
              strTxt = .TextRange
              .DeleteText
              .WarpFormat = msoWarpFormat1
              .WordWrap = True
              .AutoSize = msoAutoSizeTextToFitShape
              .TextRange = strTxt
          End With
      End If
     Next shp
    Next ws
  
  End Sub
  </code></pre>