How to get text font size after AutoSize?
You can find detailed explanation inside to following code.
Private Sub Macro1()
'Delete all slides
For i = ActivePresentation.Slides.Count To 1 Step -1
ActivePresentation.Slides(i).Delete
Next i
'Add a blank slide
ActivePresentation.Slides.Add index:=1, Layout:=ppLayoutBlank
'Add a Rectangle
With ActivePresentation.Slides(1).Shapes.AddShape(Type:=msoShapeRectangle, Left:=100, Top:=100, Width:=500, Height:=60)
.TextFrame2.TextRange.Text = "Hello world its a really really really nice day"
.TextFrame2.TextRange.Font.Size = 40
.TextFrame2.VerticalAnchor = msoAnchorMiddle
.TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignLeft
.TextFrame2.MarginLeft = 0
.TextFrame2.MarginRight = 0
.TextFrame2.MarginTop = 0
.TextFrame2.MarginBottom = 0
'The following line makes font size automatically from 40 to 28.(You can see the 28 font size by clicking inside the Rectangle)
.TextFrame2.AutoSize = msoAutoSizeTextToFitShape
'The following line gives 40. I need a code which gives me 28.
Debug.Print .TextFrame2.TextRange.Font.Size
End With
End Sub
The following link didnt help me.
Excel / PowerPoint text size after shrink to fit