ContainingObject Property

Microsoft Publisher Visual Basic

expression.ContainingObject

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example returns the name of the object containing the specified text range.

Sub NameOfContainingObject()
    With ActiveDocument.Pages(1).Shapes(1).TextFrame _
            .TextRange.ContainingObject
        MsgBox The name of the object containing the text is " & .Name
    End With
End Sub