TextRange.RotatedBounds Method (PowerPoint)

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

Syntax

expression. RotatedBounds( _X1_, _Y1_, _X2_, _Y2_, _X3_, _Y3_, _X4_, _Y4_ )

expression A variable that represents a TextRange object.

Parameters

Name Required/Optional Data Type Description
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

See also

TextRange Object