# Update-OfficeWordText

Replaces text in a Word document. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: Replace-OfficeWordText

**Module**

`PSWriteOffice`

**Aliases**

`Replace-OfficeWordText`

**Inputs**

`OfficeIMO.Word.WordDocument`

**Outputs**

`System.Int32`

**Source**

[UpdateOfficeWordTextCommand.cs:25](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Word/UpdateOfficeWordTextCommand.cs#L25) 

Replaces text in a Word document.

## Syntax

```
Update-OfficeWordText
[-CaseSensitive]
[-IncludeHyperlinkAnchor]
[-IncludeHyperlinkText]
[-IncludeHyperlinkTooltip]
[-IncludeHyperlinkUri]
-NewValue <String>
-OldValue <String>
[-PassThru]
[<CommonParameters>]
```

[#](#method-update-officewordtext-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-string-string-switchparameter)

Parameter set: `Auto`

```
Update-OfficeWordText
[-CaseSensitive]
[-Document <WordDocument>]
[-IncludeHyperlinkAnchor]
[-IncludeHyperlinkText]
[-IncludeHyperlinkTooltip]
[-IncludeHyperlinkUri]
-NewValue <String>
-OldValue <String>
[-PassThru]
[<CommonParameters>]
```

[#](#method-update-officewordtext-switchparameter-worddocument-switchparameter-switchparameter-switchparameter-switchparameter-string-string-switchparameter)

Parameter set: `Document`

```
Update-OfficeWordText
[-CaseSensitive]
[-IncludeHyperlinkAnchor]
[-IncludeHyperlinkText]
[-IncludeHyperlinkTooltip]
[-IncludeHyperlinkUri]
-NewValue <String>
-OldValue <String>
[-Open]
[-PassThru]
[-Path] <String>
[<CommonParameters>]
```

[#](#method-update-officewordtext-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-string-string-switchparameter-switchparameter-string)

Parameter set: `Path`

## Description

Supports direct document objects, file paths, and the active DSL document. Hyperlink labels and metadata can be updated when requested.

## Examples

### Replace text in an open document.

```powershell
$count = $doc | Update-OfficeWordText -OldValue 'FY24' -NewValue 'FY25' -PassThru
```

Updates matching text in the loaded document and returns the number of replacements.

### Replace hyperlink targets in a file.

```powershell
Update-OfficeWordText -Path .\Report.docx -OldValue 'old.example.com' -NewValue 'new.example.com' -IncludeHyperlinkUri
```

Loads the document, updates matching hyperlink URLs, saves the file, and closes it.

## Parameters

**-CaseSensitive SwitchParameter optional**

Use case-sensitive matching.

**-IncludeHyperlinkAnchor SwitchParameter optional**

Also replace hyperlink anchors.

**-IncludeHyperlinkText SwitchParameter optional**

Also replace hyperlink display text.

**-IncludeHyperlinkTooltip SwitchParameter optional**

Also replace hyperlink tooltips.

**-IncludeHyperlinkUri SwitchParameter optional**

Also replace hyperlink URIs.

**-NewValue String required**

Replacement text.

**-OldValue String required**

Text to find.

**-PassThru SwitchParameter optional**

Emit the object created or changed by the command.

**-Document WordDocument optionalpipeline: True (ByValue)sets: Document**

Document to update.

**-Open SwitchParameter optionalaliases: Showsets: Path**

Open the file after saving when using -Path.

**-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path**

Path to the .docx file to update in place.

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:181F2768C6B556D6CE4415D2D5C95A8D72725DB541E430637144918BF777AA74 -->
