InlineShapes Property

Microsoft Publisher Visual Basic

InlineShapes Property

Returns an InlineShapes collection, which represents the inline shapes contained within a text range. Read-only.

expression.InlineShapes

expression    Required. An expression that returns a TextRange object.

Remarks

Using TextFrame.Story.TextRange.InlineShapes will return all inline shapes in a text frame, including those that are in overflow. Using TextFrame.TextRange.InlineShapes will return only visible inline shapes in a text frame, and not those that are in overflow.

Example

The following example finds the first shape (a text box) on page one of the active publication. The InlineShapes property is then used to determine whether any inline shapes exist in the text box. If any are found, each inline shape is flipped vertically, and its fore color is set to red.

Note that by using TextFrame.Story.TextRange.InlineShapes, any inline shapes that are in overflow will also be found.

    Dim theShape As Shape
Dim i As Integer

Set theShape = ActiveDocument.Pages(1).Shapes(1)

With theShape.TextFrame.Story.TextRange
    If .InlineShapes.Count > 0 Then
        For i = 1 To .InlineShapes.Count
            .InlineShapes(i).Flip (msoFlipVertical)
            .InlineShapes(i).Fill.ForeColor.RGB = vbRed
        Next
    End If
End With