Table of contents
Collapse the table of content
Expand the table of content

TextFrame2.HasText Property (Office)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Indicates whether the shape that contains the specified text frame has text associated with it. Read-only


expression. HasText

expression An expression that returns a TextFrame2 object.


The value of the HasText property can be one of the following MsoTriState constants.

msoFalseThe specified text frame does not have text.
msoTrueThe specified text frame has text.


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


TextFrame2 Object

Other resources

TextFrame2 Object Members

© 2018 Microsoft