title: How to resize a textbox in Visual Basic for Powerpoint 2010
body: <p>I would like to know if there's a known way to 'fit' a text box (assuming the text does not wrap) in Visual Basic 2010. This could be somewhat equivalent to just defining a text box and letting the entered text define the width / height, like in PowerPoint's GUI where a newly created textbox simply expands as one types. My code is as follows:</p>
  
  <pre><code>Set tbox1 = slideObject.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, Left:=20, Top:=300, Width:=72, Height:=16)
  
  With tbox1.TextFrame.TextRange
    .Text = "the text in the text box"
    .Font.Bold = True
    .Font.Name = "Calibri"
    .Font.Size = 10
  End With
  
  With tbox1.Fill
    .Visible = True
    .ForeColor.RGB = RGB(255, 255, 255)
  End With
  
  With tbox1.Line
    .Visible = True
    .ForeColor.RGB = RGB(0, 0, 0)
    .Weight = 2
  End With
  </code></pre>
  
  <p>Thanks for the help!!!</p>