XmlMappedRange.Replace Method
Replaces the specified characters in the XmlMappedRange control with a new string.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
Function Replace ( _
What As Object, _
Replacement As Object, _
LookAt As Object, _
SearchOrder As Object, _
MatchCase As Object, _
MatchByte As Object, _
SearchFormat As Object, _
ReplaceFormat As Object _
) As Boolean
bool Replace(
Object What,
Object Replacement,
Object LookAt,
Object SearchOrder,
Object MatchCase,
Object MatchByte,
Object SearchFormat,
Object ReplaceFormat
)
Parameters
What
Type: System.ObjectThe string you want Microsoft Office Excel to search for.
Replacement
Type: System.ObjectThe replacement string.
LookAt
Type: System.ObjectCan be one of the following XlLookAt constants: xlWhole or xlPart.
SearchOrder
Type: System.ObjectCan be one of the following XlSearchOrder constants: xlByRows or xlByColumns.
MatchCase
Type: System.Objecttrue to make the search case sensitive.
MatchByte
Type: System.ObjectYou can use this argument only if you have selected or installed double-byte language support in Excel. true to have double-byte characters match only double-byte characters; false to have double-byte characters match their single-byte equivalents.
SearchFormat
Type: System.ObjectThe search format for the method.
ReplaceFormat
Type: System.ObjectThe replace format for the method.
Return Value
Type: System.Boolean
true if the specified characters are in the XmlMappedRange control; otherwise, false.
Remarks
Using this method does not change either the selection or the active cell.
The settings for LookAt, SearchOrder, MatchCase, and MatchByte are saved each time you use this method. If you do not specify values for these arguments the next time you call the method, the saved values are used. Setting these arguments changes the settings in the Find dialog box, and changing the settings in the Find dialog box changes the saved values that are used if you omit the arguments. To avoid problems, set these arguments explicitly each time you use this method.
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example uses the Replace method to replace the string "Smith" with the string "Jones" within an XmlMappedRange. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.
Private Sub ReplaceSmith()
Me.CustomerLastNameCell.Value2 = "Walker, Smith, James"
Me.CustomerLastNameCell.Replace("Smith", "Jones")
End Sub
private void ReplaceSmith()
{
this.CustomerLastNameCell.Value2 = "Walker, Smith, James";
this.CustomerLastNameCell.Replace("Smith", "Jones");
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.