Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Update-OfficeExcelComment

Aliases: ExcelCommentUpdate
Module PSWriteOffice
Aliases
ExcelCommentUpdate
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Int32

Updates legacy worksheet comments (notes) that match a filter.

Syntax

Update-OfficeExcelComment [-Address <String>] [-All] [-Author <String>] [-Initials <String>] [-MatchAuthor <String>] [-PassThru] [-Range <String>] [-Run <Object[]>] [-Sheet <String>] [-SheetIndex <Int32>] [-Text <String>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Context
Update-OfficeExcelComment [-Address <String>] [-All] [-Author <String>] [-Initials <String>] [-MatchAuthor <String>] [-PassThru] [-Path] <String> [-Range <String>] [-Run <Object[]>] [-Sheet <String>] [-SheetIndex <Int32>] [-Text <String>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Path
Update-OfficeExcelComment [-Address <String>] [-All] [-Author <String>] -Document <ExcelDocument> [-Initials <String>] [-MatchAuthor <String>] [-PassThru] [-Range <String>] [-Run <Object[]>] [-Sheet <String>] [-SheetIndex <Int32>] [-Text <String>] [-TextContains <String>] [<CommonParameters>]
#
Parameter set: Document

Examples

Authored help example

Update a comment on one cell.

$updated = Update-OfficeExcelComment -Path .\Report.xlsx -Sheet Data -Address B2 -Text 'Reviewed' -Author Carol -Initials CC -PassThru
Get-OfficeExcelComment -Path .\Report.xlsx -Sheet Data -Address B2 |
    Select-Object Address, Author, Text

Replaces matching comment text and optionally changes the author.

Parameters

-Address String optional
A1 cell address to match.
-All SwitchParameter optional
Allow updating all comments on the selected worksheet(s) when no filter is supplied.
-Author String optional
Replacement author name.
-Initials String optional
Replacement author initials.
-MatchAuthor String optional
Existing comment author to match, ignoring case.
-PassThru SwitchParameter optional
Returns the number of comments updated.
-Range String optional
A1 cell or range to match.
-Run Object[] optionalaliases: Runs
Replacement rich text runs.
-Sheet String optional
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
-SheetIndex Int32 optional
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
-Text String optional
Replacement plain text.
-TextContains String optional
Existing text fragment to match, ignoring case.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to update.
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
Workbook to update outside the DSL context.

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.