Share via


TextRange.ContainingObject Property

Publisher Developer Reference

Returns an Object that represents the object that contains the text range. Read-only.

Syntax

expression.ContainingObject

expression   A variable that represents a TextRange object.

Return Value
Object

Example

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

Visual Basic for Applications
  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

See Also