Class TextStyle (PowerPoint VBA)

The class TextStyle represents one of three text styles: title text, body text, or default text. Each text style contains a TextFrame object that describes how text is placed within the text bounding box, a Ruler object that contains tab stops and outline indent formatting information, and a TextStyleLevels collection that contains outline text formatting information. The TextStyle object is a member of the TextStyles collection. To use a TextStyle class variable it first needs to be instantiated, for example


Dim tse as TextStyle
Set tse = ActivePresentation.SlideMaster.TextStyles(Type:=1)

Levels

Returns a TextStyleLevels object that represents outline text formatting.


Dim tslsLevels As TextStyleLevels
Set tslsLevels = ActivePresentation.SlideMaster.TextStyles(1).Levels

Ruler

Returns a Ruler object that represents the ruler for the specified text.


Dim rlrRuler As Ruler
Set rlrRuler = ActiveWindow.Selection.SlideRange(1).TextStyles(1).Ruler

TextFrame

Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape or master text style.

Use the TextRange property of the TextFrame object to return the text in the text frame. Use the HasTextFrame property to determine whether a shape contains a text frame before you apply the TextFrame property.


Dim tfeTextFrame As TextFrame
Set tfeTextFrame = ActiveWindow.Selection.SlideRange(1).TextStyles(1).TextFrame