RotatedBounds Method

Microsoft PowerPoint Visual Basic

Returns the coordinates of the vertices of the text bounding box for the specified text range.

expression.RotatedBounds(X1, Y1, X2, Y2, X3, Y3, X4, Y4)

expression    Required. An expression that returns a TextRange object.

X1, Y1    Required Single. Returns the position (in points) of the first vertex of the bounding box for the text within the specified text range.

X2, Y2    Required Single. Returns the position (in points) of the second vertex of the bounding box for the text within the specified text range.

X3, Y3    Required Single. Returns the position (in points) of the third vertex of the bounding box for the text within the specified text range.

X4, Y4    Required Single. Returns the position (in points) of the fourth vertex of the bounding box for the text within the specified text range.

Example

This example uses the values returned by the arguments of the RotatedBounds method to draw a freeform that has the dimensions of the text bounding box for the third word in the text range in shape one on slide one in the active presentation.

Dim x1 As Single, y1 As Single
Dim x2 As Single, y2 As Single
Dim x3 As Single, y3 As Single
Dim x4 As Single, y4 As Single
Dim myDocument As Slide

Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes(1).TextFrame.TextRange.Words(3).RotatedBounds _
    x1, y1, x2, y2, x3, y3, x4, y4
With myDocument.Shapes.BuildFreeform(msoEditingCorner, x1, y1)
    .AddNodes msoSegmentLine, msoEditingAuto, x2, y2
    .AddNodes msoSegmentLine, msoEditingAuto, x3, y3
    .AddNodes msoSegmentLine, msoEditingAuto, x4, y4
    .AddNodes msoSegmentLine, msoEditingAuto, x1, y1
    .ConvertToShape.ZOrder msoSendToBack
End With