Class TextRange (PowerPoint VBA)

Contains the text that's attached to a shape, and properties and methods for manipulating the text.

The classes Selection and TextFrame. give access to class TextRange

To use a TextRange class variable it first needs to be instantiated, for example

Dim tre as TextRange
Set tre = ActiveWindow.Selection.TextRange
The following procedures can be used to set variables of type TextRange: Selection.TextRange, TextFrame.TextRange, Characters, Find, InsertAfter, InsertBefore, InsertDateTime, InsertSlideNumber, InsertSymbol, Lines, Paragraphs, Paste, PasteSpecial, Replace ...Runs, Sentences, TrimText, Words.

Methods

AddPeriods - Adds a period at the end of each paragraph in the specified text.

ChangeCase - Changes the case of the specified text.

Characters - 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.

Copy - Copies the specified object to the Clipboard.

Cut - Deletes the specified object and places it on the Clipboard.

Delete - Deletes the specified TextRange object.

Find - Finds the specified text in a text range, and returns a TextRange object that represents the first text range where the text is found. Returns Nothing if no match is found.

InsertAfter - Appends a string to the end of the specified text range. Returns a TextRange object that represents the appended text. When used without an argument, this method returns a zero-length string at the end of the specified range.

InsertBefore - Appends a string to the beginning of the specified text range. Returns a TextRange object that represents the appended text. When used without an argument, this method returns a zero-length string at the end of the specified range.

InsertDateTime - Inserts the date and time in the specified text range. Returns a TextRange object that represents the inserted text.

InsertSlideNumber - Inserts the slide number of the current slide into the specified text range. Returns a TextRange object that represents the slide number.

InsertSymbol - Returns a TextRange object that represents a symbol inserted into the specified text range.

Lines - Returns a TextRange object that represents the specified subset of text lines. For information about counting or looping through the lines in a text range, see the TextRange object.

LtrRun - Sets the direction of text in a text range to read from left to right.

Paragraphs - Returns a TextRange object that represents the specified subset of text paragraphs.

Paste - Pastes the text on the Clipboard into the specified text range, and returns a TextRange object that represents the pasted text.

PasteSpecial - Replaces the text range with the contents of the Clipboard in the format specified.

RemovePeriods - Removes the period at the end of each paragraph in the specified text.

Replace - Finds specific text in a text range, replaces the found text with a specified string, and returns a TextRange object that represents the first occurrence of the found text. Returns Nothing if no match is found.

RotatedBounds - Returns the coordinates of the vertices of the text bounding box for the specified text range.

RtlRun - Sets the direction of text in a text range to read from right to left.

Runs - Returns a TextRange object that represents the specified subset of text runs. A text run consists of a range of characters that share the same font attributes.

Select - Selects the specified object.

Sentences - Returns a TextRange object that represents the specified subset of text sentences.

TrimText - Returns a TextRange object that represents the specified text minus any trailing spaces.

Words - Returns a TextRange object that represents the specified subset of text words.

Properties

Text (Default member) - Returns or sets a String that represents the text contained in the specified object.

ActionSettings returns an ActionSettings object that contains information about what action occurs when the user clicks or moves the mouse over the specified shape or text range during a slide show.

BoundHeight returns the height (in points) of the text bounding box for the specified text frame.

BoundLeft returns the distance (in points) from the left edge of the text bounding box for the specified text frame to the left edge of the slide.

BoundTop returns the distance (in points) from the top of the of the text bounding box for the specified text frame to the top of the slide.

BoundWidth returns the width (in points) of the text bounding box for the specified text frame.

Count returns the number of objects in the specified collection.

Font returns a Font object that represents character formatting.

IndentLevel returns or sets the indent level for the specified text as an integer from 1 to 5, where 1 indicates a first-level paragraph with no indentation.

LanguageID returns or sets the language for the specified text range.

Length returns the length of the specified text range, in characters.

ParagraphFormat returns a ParagraphFormat object that represents paragraph formatting for the specified text.

Start returns the position of the first character in the specified text range relative to the first character in the shape that contains the text.

ActionSettings - A collection that contains the two ActionSetting objects for a shape or text range. One ActionSetting object represents how the specified object reacts when the user clicks it during a slide show, and the other ActionSetting object represents how the specified object reacts when the user moves the mouse pointer over it during a slide show.

Font - Represents character formatting for text or a bullet. The Font object is a member of the Fonts collection. The Fonts collection contains all the fonts used in a presentation.

ParagraphFormat - Represents the paragraph formatting of a text range.