TextRange.Replace (PowerPoint)

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.

The MatchCase parameter value can be one of these MsoTriState constants.

Syntax : expression.Replace (FindWhat, ReplaceWhat, After, MatchCase, WholeWords)

Dim strFindWhat As String: strFindWhat = 
Dim strReplaceWhat As String: strReplaceWhat = 
Dim treReplaced As TextRange
Set treReplaced = ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Replace(FindWhat:=strFindWhat, ReplaceWhat:=strReplaceWhat)


The following arguments are required:

FindWhat (String) - The text to search for.

ReplaceWhat (String) - The text you want to replace the found text with.

The following arguments are optional

After (Long) - The position of the character (in the specified text range) after which you want to search for the next occurrence of FindWhat. For example, if you want to search from the fifth character of the text range, specify 4 for After. If this argument is omitted, the first character of the text range is used as the starting point for the search.

MatchCase (Office.MsoTriState) - Determines whether a distinction is made on the basis of case.

WholeWords (Office.MsoTriState) - Determines whether only whole words are found.