TextFrame2.AutoSize property (PowerPoint)
Returns or sets a value that indicates whether the size of the specified shape is changed automatically to fit text within its boundaries. Read/write.
Syntax
expression.AutoSize
expression An expression that returns a TextFrame2 object.
Return value
MsoAutoSize
Remarks
The value of the AutoSize property can be one of the following MsoAutoSize constants.
msoAutoSizeMixed |
msoAutoSizeNone |
msoAutoSizeShapeToFitText |
msoAutoSizeTextToFitShape |
Example
The following example shows how to adjust the size of the title text on slide one to fit the text frame that contains it.
Public Sub AutoSize_Example()
Dim pptSlide As Slide
Set pptSlide = ActivePresentation.Slides(1)
With pptSlide.Shapes(1)
If .TextFrame2.TextRange.Characters.Count < 50 Then
.TextFrame2.AutoSize = msoAutoSizeTextToFitShape
End If
End With
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for