API Reference

Cmdlet

Set-OfficeExcelDataValidationMessage

Aliases: ExcelDataValidationMessage
Namespace PSWriteOffice
Aliases
ExcelDataValidationMessage
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Management.Automation.PSObject

Sets prompt and error messages on existing Excel data validation rules.

Remarks

Sets prompt and error messages on existing Excel data validation rules.

Examples

Authored help example

Add prompt and error text to a validation rule.

PS>


$rules = Set-OfficeExcelDataValidationMessage -Path .\Report.xlsx -Sheet Data -HeaderName Sales -TableName ServiceHealth -PromptTitle 'Sales' -Prompt 'Enter 1-1000' -ErrorTitle 'Invalid sales' -ErrorMessage 'Enter a whole number from 1 to 1000' -ShowInputMessage -ShowErrorMessage -PassThru
            $rules |
                Select-Object Range, PromptTitle, ErrorTitle
        

Updates validation metadata for matching rules and saves the workbook.

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.

Syntax

Set-OfficeExcelDataValidationMessage [-ErrorMessage <String>] [-ErrorTitle <String>] [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Prompt <String>] [-PromptTitle <String>] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ShowErrorMessage] [-ShowInputMessage] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Context

Parameters

ErrorMessage String optionalposition: namedpipeline: Falsealiases: Error
Error message text. Omit or pass null to clear the message.
ErrorTitle String optionalposition: namedpipeline: False
Error title. Omit or pass null to clear the title.
HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the validation rules to update.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
PassThru SwitchParameter optionalposition: namedpipeline: False
Returns matching validation rules after updating them.
Prompt String optionalposition: namedpipeline: False
Input prompt text. Omit or pass null to clear the prompt.
PromptTitle String optionalposition: namedpipeline: False
Input prompt title. Omit or pass null to clear the title.
Range String optionalposition: namedpipeline: False
A1 range used to select existing validation rules.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet.
ShowErrorMessage SwitchParameter optionalposition: namedpipeline: False
Forces Excel to show the validation error.
ShowInputMessage SwitchParameter optionalposition: namedpipeline: False
Forces Excel to show the input prompt.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.

Outputs

System.Management.Automation.PSObject

Set-OfficeExcelDataValidationMessage [-ErrorMessage <String>] [-ErrorTitle <String>] [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] -InputPath <String> [-PassThru] [-Prompt <String>] [-PromptTitle <String>] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ShowErrorMessage] [-ShowInputMessage] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Path

Parameters

ErrorMessage String optionalposition: namedpipeline: Falsealiases: Error
Error message text. Omit or pass null to clear the message.
ErrorTitle String optionalposition: namedpipeline: False
Error title. Omit or pass null to clear the title.
HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the validation rules to update.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Workbook path to update.
PassThru SwitchParameter optionalposition: namedpipeline: False
Returns matching validation rules after updating them.
Prompt String optionalposition: namedpipeline: False
Input prompt text. Omit or pass null to clear the prompt.
PromptTitle String optionalposition: namedpipeline: False
Input prompt title. Omit or pass null to clear the title.
Range String optionalposition: namedpipeline: False
A1 range used to select existing validation rules.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet.
ShowErrorMessage SwitchParameter optionalposition: namedpipeline: False
Forces Excel to show the validation error.
ShowInputMessage SwitchParameter optionalposition: namedpipeline: False
Forces Excel to show the input prompt.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.

Outputs

System.Management.Automation.PSObject

Set-OfficeExcelDataValidationMessage -Document <ExcelDocument> [-ErrorMessage <String>] [-ErrorTitle <String>] [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-PassThru] [-Prompt <String>] [-PromptTitle <String>] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-ShowErrorMessage] [-ShowInputMessage] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to update outside the DSL context.
ErrorMessage String optionalposition: namedpipeline: Falsealiases: Error
Error message text. Omit or pass null to clear the message.
ErrorTitle String optionalposition: namedpipeline: False
Error title. Omit or pass null to clear the title.
HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the validation rules to update.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
PassThru SwitchParameter optionalposition: namedpipeline: False
Returns matching validation rules after updating them.
Prompt String optionalposition: namedpipeline: False
Input prompt text. Omit or pass null to clear the prompt.
PromptTitle String optionalposition: namedpipeline: False
Input prompt title. Omit or pass null to clear the title.
Range String optionalposition: namedpipeline: False
A1 range used to select existing validation rules.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet.
ShowErrorMessage SwitchParameter optionalposition: namedpipeline: False
Forces Excel to show the validation error.
ShowInputMessage SwitchParameter optionalposition: namedpipeline: False
Forces Excel to show the input prompt.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.

Outputs

System.Management.Automation.PSObject