Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Update-OfficeExcelComment

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument

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>]
#
Parameter set: Text
Update-OfficeExcelComment
[-All]
[-Author <String>]
[-Content] <ScriptBlock>
[-Document <ExcelDocument>]
[-Initials <String>]
[-MatchAuthor <String>]
[-PassThru]
[-Range <String>]
[-Sheet <OfficeSheetSelector[]>]
[-TextContains <String>]
[<CommonParameters>]
#
Parameter set: RichText

Examples

Change the text of matching notes

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

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.