TextFrame2.HasText property (Office)
Indicates whether the shape that contains the specified text frame has text associated with it. Read-only.
Syntax
expression.HasText
expression An expression that returns a TextFrame2 object.
Remarks
The value of the HasText property can be one of the following MsoTriState constants.
Constant | Description |
---|---|
msoFalse | The specified text frame does not have text. |
msoTrue | The specified text frame has text. |
Example
The following code tests whether shape two on slide one contains text, and if it does, resizes the shape to fit the text.
Dim pptSlide As Slide
Set pptSlide = ActivePresentation.Slides(1)
With pptSlide.Shapes(2).TextFrame
If .HasText Then .AutoSize = ppAutoSizeShapeToFitText
End With
See also
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.