Last active
August 29, 2015 13:56
-
-
Save ozero/8999202 to your computer and use it in GitHub Desktop.
Powerpoint vba AutoSize_Example. For all TextShapes in all slides, all presentation windows, shrink font size to fit with textbox.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' mod from msdn http://msdn.microsoft.com/en-us/library/office/ff744773.aspx | |
Public Sub AutoSize_Example() | |
Dim prs As Presentation | |
Dim pptSlide As Slide | |
For Each prs In Presentations | |
Debug.Print prs.Name | |
For Each pptSlide In prs.Slides | |
For i = 1 To pptSlide.Shapes.Count Step 1 | |
Set Shape = pptSlide.Shapes(i) | |
If Shape.HasTextFrame Then | |
'TODO: check AltTxt here | |
' http://msdn.microsoft.com/en-us/library/office/ff744026.aspx | |
Set tf2 = Shape.TextFrame2 | |
Debug.Print tf2.TextRange.Characters | |
If tf2.TextRange.Characters.Count < 50 Then | |
tf2.AutoSize = msoAutoSizeTextToFitShape | |
End If | |
End If | |
Next | |
Next pptSlide | |
Next prs | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment