Jamie Garroch (MVP)
asked on
Setting the SpaceAfter for a paragraph causes huge spacing with certain shapes in VBA
I am trying to set the SpaceAfter property of a paragraph of text in a shape within PowerPoint with this line of code in the Immediate Window of the VBE:
But even more odd is that when I read back the value with the following line, I get 6:
What is happening?
Paragraph-Spacing-Comparison.pptx
ActiveWindow.Selection.ShapeRange(1).TextFrame.TextRange.ParagraphFormat.SpaceAfter=6
Sometimes it works and sometimes it doesn't. When it doesn't work, it appears to set the spacing to a very large value, which looks like it's 6 * Font Size * 1.2 = 115.2pt in my example with 16pt text!!!But even more odd is that when I read back the value with the following line, I get 6:
?ActiveWindow.Selection.ShapeRange(1).TextFrame.TextRange.ParagraphFormat.SpaceAfter
The attached deck demonstrates the issue. The left and right shapes have their spacing set to the incorrect value whilst the centre one doesn't.What is happening?
Paragraph-Spacing-Comparison.pptx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Open in new window
Output for the two orange shapes:Open in new window