Autofit context to box
- Open the PowerPoint.
- Go to Tools → Macro → Visual Basic Editor.
If you have the Developer tab, you can also use Developer → Visual Basic. - Choose Insert → Module.
- Paste this:
Sub ShrinkTextOnOverflow_AllSlides()
Dim sld As Slide
Dim shp As Shape
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
SetShrinkToFit shp
Next shp
Next sld
MsgBox "All text boxes are now set to Shrink Text on Overflow."
End Sub
Sub SetShrinkToFit(ByVal shp As Shape)
Dim i As Long
Dim r As Long
Dim c As Long
On Error Resume Next
' Handle grouped objects
If shp.Type = msoGroup Then
For i = 1 To shp.GroupItems.Count
SetShrinkToFit shp.GroupItems(i)
Next i
' Handle tables
ElseIf shp.HasTable Then
For r = 1 To shp.Table.Rows.Count
For c = 1 To shp.Table.Columns.Count
With shp.Table.Cell(r, c).Shape.TextFrame2
.WordWrap = msoTrue
.AutoSize = msoAutoSizeTextToFitShape
End With
Next c
Next r
' Handle regular text boxes and placeholders
ElseIf shp.HasTextFrame Then
With shp.TextFrame2
.WordWrap = msoTrue
.AutoSize = msoAutoSizeTextToFitShape
End With
End If
On Error GoTo 0
End Sub
Then close the Visual Basic window and go to Tools → Macro → Macros, select , and click Run.

Post a Comment