WizardProperty 属性 (Publisher)WizardProperty.Parent property (Publisher)

返回一个对象,代表指定对象的父对象。Returns an object that represents the parent object of the specified object. 例如,对于 TextFrame 对象,返回代表文字框架的父形状的 Shape 对象。For example, for a TextFrame object, returns a Shape object representing the parent shape of the text frame. 此为只读属性。Read-only.

语法Syntax

表达式expression.Parent

_表达式_一个代表**WizardProperty** 对象的变量。expression A variable that represents a WizardProperty object.

示例Example

以下示例访问选定形状的父对象,然后向其添加新的形状,并设置新形状的填充内容。This example accesses the parent object of the selected shape, and then adds a new shape to it and sets the fill for the new shape.

Sub ParentObject() 
 Dim shp As Shape 
 Dim pg As Page 
 
 Set pg = Selection.ShapeRange(1).Parent 
 Set shp = pg.Shapes.AddShape(Type:=msoShape5pointStar, _ 
 Left:=72, Top:=72, Width:=72, Height:=72) 
 
 shp.Fill.ForeColor.RGB = RGB(Red:=180, Green:=180, Blue:=180) 
End Sub

以下示例返回文字框架的父对象,该对象是当前出版物中的第一个形状,然后以图案填充该形状。This example returns the parent object of a text frame, which is the first shape in the active publication, and then fills the shape with a pattern.

Sub ParentShape() 
 Dim shpParent As Shape 
 Set shpParent = ActiveDocument.Pages(1).Shapes(1).TextFrame.Parent 
 shpParent.Fill.Patterned Pattern:=msoPatternSphere 
End Sub

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.