# Update-OfficeExcelComment

Replaces the text or author of notes that match a filter.

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Source**

[UpdateOfficeExcelCommentCommand.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/PowerShell/PSWriteOffice/Sources/PSWriteOffice/Cmdlets/Excel/UpdateOfficeExcelCommentCommand.cs#L33) 

Replaces the text or author of notes that match a filter.

## Syntax

```
Update-OfficeExcelComment
[-All]
[-Author <String>]
[-Document <ExcelDocument>]
[-Initials <String>]
[-MatchAuthor <String>]
[-PassThru]
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-Text <String>]
[-TextContains <String>]
[<CommonParameters>]
```

[#](#method-update-officeexcelcomment-switchparameter-string-exceldocument-string-string-switchparameter-string-officesheetselector-string-string)

Parameter set: `Text`

```
Update-OfficeExcelComment
[-All]
[-Author <String>]
[-Content] <ScriptBlock>
[-Document <ExcelDocument>]
[-Initials <String>]
[-MatchAuthor <String>]
[-PassThru]
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-TextContains <String>]
[<CommonParameters>]
```

[#](#method-update-officeexcelcomment-switchparameter-string-scriptblock-exceldocument-string-string-switchparameter-string-officesheetselector-string)

Parameter set: `RichText`

## Examples

### Change the text of matching notes

```powershell
Open-OfficeExcel -Path .\Finance\Budget-2027.xlsx {
    Update-OfficeExcelComment -Sheet Assumptions -TextContains 'TBD' -Text 'Confirmed with the vendor on 24 October.'
}
```

Replaces the text of every note that says TBD on the Assumptions sheet.

### Hand notes over to a new owner

```powershell
Open-OfficeExcel -Path .\Reports\Helpdesk.xlsx {
    Update-OfficeExcelComment -MatchAuthor 'jnowak' -Author 'Service Desk' -Initials 'SD'
    Update-OfficeExcelComment -Sheet Tickets -Range F40 {
        ExcelText 'Escalated: ' -Bold -Color Danger
        ExcelText 'vendor case 88412 opened.'
    }
}
```

Moves every note written by a departing colleague to the team account and rewrites one escalation note with rich text.

## Parameters

**-All SwitchParameter optional**

Explicitly selects every item when no filter is supplied.

**-Author String optional**

Replacement author name.

**-Document ExcelDocument optionalpipeline: True (ByValue)**

Caller-owned workbook; omission uses the enclosing Excel content block.

**-Initials String optional**

Author initials, supplied together with Author.

**-MatchAuthor String optional**

Existing comment author to match, ignoring case.

**-PassThru SwitchParameter optional**

Emits the native result after the operation.

**-Range String optional**

A1 cell range on the selected worksheet.

**-Sheet OfficeSheetSelector[] optional**

Worksheet name, one-based position or native worksheet object. Multi-sheet commands also accept wildcard names.

**-Text String optionalsets: Text**

Replacement plain text.

**-TextContains String optional**

Existing text fragment to match, ignoring case.

**-Content ScriptBlock requiredposition: 0sets: RichText**

Excel child commands executed in the current content scope.

## 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).

<!-- PowerForge markdown artifact sha256:EF80B96254B317D8B0CD96C563FB0D0C5E15FE7511C7607E7ECFC33121A3D63F -->
