-
Notifications
You must be signed in to change notification settings - Fork 0
TextRange
MSO Model Help Page: TextRange object (PowerPoint)
- TextRange.Words method
- TextRange.Characters method
Returns a TextRange object that represents the specified subset of text words.
MSO Model Help Page: TextRange.Words method
Syntax: expression.Words( Start, Length )
Output the first 3 words of text in a TextFrame
PPT.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Words(0,3).Text
Returns a TextRange object that represents the specified subset of text characters. For information about counting or looping through the characters in a text range, see the TextRange object.
MSO Model Help Page: TextRange.Characters method
Syntax: expression.Characters( Start, Length )
Output the first 10 characters of text in a TextFrame object, starting at 0 and grabbing a length of 10 characters from that point on.
PPT.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(0,10).Text
Change the first 5 characters of text in a string to Bold
PPT.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(1, 5).Font.Bold = True
Check if selected text characters are Bold. -1 if they are all Bold & -2 if they are all not Bold
PPT.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(1, 4).Font.Bold
Change the color of the text
PPT.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(15, 25).Font.Color.RGB = rgb_to_hex((255, 127, 255))
Change the case of the text
PPT.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.ChangeCase(3)
Case Type | Case Integer Value | Description |
---|---|---|
ppCaseSentence | 1 | Change to lowercase. |
ppCaseLower | 2 | Change to lowercase. |
ppCaseUpper | 3 | Change to uppercase. |
ppCaseTitle | 4 | Change to title case. |
ppCaseToggle | 5 | Toggle the casing. |