TextRange.ContainingObject property (Publisher)

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.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.