I'm using VBA in powerpoint.
I executed following code and AutoSize doesn't work.
A page is created, title and textbox is created into this page. Textbox doesn't fit automatically.
Please help me.
Sub page_create()
Dim myPresentation As Presentation
Dim mySlide As Slide
Set myPresentation = ActivePresentation
'There are 1st slide before!!
Set mySlide = myPresentation.Slides.Add(2, ppLayoutTitleOnly)
mySlide.Shapes.Title.TextFrame.TextRange.Text = "Examples"
Set prevShape = mySlide.Shapes(mySlide.Shapes.Count)
Set myTextbox = mySlide.Shapes.AddTextbox(msoTextOrientationHorizontal, prevShape.Left, prevShape.Top + prevShape.Height, 0, 0)
myTextbox.TextFrame.AutoSize = ppAutoSizeShapeToFitText
myTextbox.TextFrame.TextRange.Text = "list, set, int, float, str, tuple"
I changed the order of following sentences, but it doesn't work.
myTextbox.TextFrame.AutoSize = ppAutoSizeShapeToFitText
myTextbox.TextFrame.TextRange.Text = "list, set, int, float, str, tuple"
I referenced this
adding
myTextbox.TextFrame.WordWrap = Falseworked for me.