# Replace Text in Document

> `UiPath.Word.Activities.WordReplaceText`

`UiPath.Word.Activities.WordReplaceText`

## Description

Replaces all occurrences of a text in a Word document with another specified text. This activity must be added inside a [Use Word File](https://docs.uipath.com/activities/other/latest/productivity/word-application-scope) activity.

To learn how to use this activity:

* Create a project using the **Complete Word Template from Excel and Email** [project template](https://docs.uipath.com/studiox/standalone/latest/user-guide/project-templates).
* Follow the [Tutorial: Working with Word Automation](https://docs.uipath.com/studiox/standalone/2024.10/user-guide/tutorial-working-with-word-automation).

## Configuring the activity

#### In the body of the activity

* **Search for** - The text to be replaced (must not exceed 256 characters). Select Plus on the right side of the field, and then, from the menu, choose one of the available options to indicate the text:

  + Data from the Project Notebook, a parent Excel file or Outlook account. For example, select an Excel file and then select a cell that contains the text, or indicate a field from a selected email in Outlook that contains the text.
  + **Use Saved Value** - Select a value that you previously saved for later use in the project.
  + **Text** - Enter the text in the Text Builder.
  + **Ask when run** - Prompt for the text when the project is executed.
  + **Open in Advanced Editor** - Enter a VB expression.
* **Replace with** - The text to replace with (must not exceed 256 characters). Select Plus on the right side of the field and choose one of the available options to indicate the text:

  + Data from the Project Notebook, a parent Excel file or Outlook account. For example, select an Excel file and then select a cell that contains the text, or indicate a field from a selected email in Outlook that contains the text.
  + **Use Saved Value** - Select a value that you previously saved for later use in the project.
  + **Text** - Enter the text in the Text Builder.
  + **Ask when run** - Prompt for the text when the project is executed.
  + **Open in Advanced Editor** - Enter a VB expression.

#### Properties panel

**Common**

* **DisplayName** - The name displayed for the activity in the Designer panel.

**Input**

* See the options in the body of the activity.

**Misc**

* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level.

**Result**

* **Found** - A Boolean value that is TRUE if the text was found in the document or FALSE if the text was not found. You can save the value for later use in the project.
