HasText 属性 (PowerPoint) TextFrameTextFrame.HasText property (PowerPoint)

返回一个值,该值指示指定形状是否有与其关联的文本。Returns whether the specified shape has text associated with it. 此为只读属性。Read-only.

语法Syntax

表达式HasTextexpression.HasText

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

返回值Return value

MsoTriStateMsoTriState

备注Remarks

HasText属性的值可以是下列MsoTriState常量之一。The value of the HasText property can be one of these MsoTriState constants.

常量Constant 说明Description
msoFalsemsoFalse 指定形状没有与其关联的文本。The specified shape does not have text associated with it.
msoTruemsoTrue 指定形状有与其关联的文本。The specified shape has text associated with it.

示例Example

如果 myDocument 上的第二个形状包含文本,本示例将调整该形状的大小使之适合文本。If shape two on myDocument contains text, this example resizes the shape to fit the text.

Set myDocument = ActivePresentation.Slides(1)

With myDocument.Shapes(2).TextFrame

    If .HasText Then .AutoSize = ppAutoSizeShapeToFitText

End With

另请参阅See also

TextFrame 对象TextFrame Object

支持和反馈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.