TextRange2.Replace(String, String, Int32, MsoTriState, MsoTriState) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Finds specific text in a text range, replaces the found text with a specified string, and returns a TextRange2 object that represents the first occurrence of the found text. Returns Nothing if no match is found.
public Microsoft.Office.Core.TextRange2 Replace (string FindWhat, string ReplaceWhat, int After = 0, Microsoft.Office.Core.MsoTriState MatchCase = Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState WholeWords = Microsoft.Office.Core.MsoTriState.msoFalse);
abstract member Replace : string * string * int * Microsoft.Office.Core.MsoTriState * Microsoft.Office.Core.MsoTriState -> Microsoft.Office.Core.TextRange2
Public Function Replace (FindWhat As String, ReplaceWhat As String, Optional After As Integer = 0, Optional MatchCase As MsoTriState = Microsoft.Office.Core.MsoTriState.msoFalse, Optional WholeWords As MsoTriState = Microsoft.Office.Core.MsoTriState.msoFalse) As TextRange2
Parameters
- FindWhat
- String
The text to search for.
- ReplaceWhat
- String
The text you want to replace the found text with.
- After
- Int32
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
- MsoTriState
Determines whether a distinction is made on the basis of case.
- WholeWords
- MsoTriState
Determines whether only whole words are searched.
Returns
TextRange2