API Reference
Cmdlet
Set-OfficeExcelDataValidationMessage
Sets prompt and error messages on existing Excel data validation rules.
Remarks
Sets prompt and error messages on existing Excel data validation rules.
Examples
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:
ContextParameters
- ErrorMessage String
- Error message text. Omit or pass null to clear the message.
- ErrorTitle String
- Error title. Omit or pass null to clear the title.
- HeaderName String
- Header or table column name used to resolve the validation rules to update.
- HeaderRow Int32
- Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
- IncludeHeader SwitchParameter
- Include the header cell in the resolved range.
- PassThru SwitchParameter
- Returns matching validation rules after updating them.
- Prompt String
- Input prompt text. Omit or pass null to clear the prompt.
- PromptTitle String
- Input prompt title. Omit or pass null to clear the title.
- Range String
- A1 range used to select existing validation rules.
- Sheet String
- Worksheet name to update. Defaults to the current DSL sheet.
- SheetIndex Nullable`1
- Worksheet index (0-based) to update. Defaults to the current DSL sheet.
- ShowErrorMessage SwitchParameter
- Forces Excel to show the validation error.
- ShowInputMessage SwitchParameter
- Forces Excel to show the input prompt.
- TableName String
- 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:
PathParameters
- ErrorMessage String
- Error message text. Omit or pass null to clear the message.
- ErrorTitle String
- Error title. Omit or pass null to clear the title.
- HeaderName String
- Header or table column name used to resolve the validation rules to update.
- HeaderRow Int32
- Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
- IncludeHeader SwitchParameter
- Include the header cell in the resolved range.
- InputPath String
- Workbook path to update.
- PassThru SwitchParameter
- Returns matching validation rules after updating them.
- Prompt String
- Input prompt text. Omit or pass null to clear the prompt.
- PromptTitle String
- Input prompt title. Omit or pass null to clear the title.
- Range String
- A1 range used to select existing validation rules.
- Sheet String
- Worksheet name to update. Defaults to the current DSL sheet.
- SheetIndex Nullable`1
- Worksheet index (0-based) to update. Defaults to the current DSL sheet.
- ShowErrorMessage SwitchParameter
- Forces Excel to show the validation error.
- ShowInputMessage SwitchParameter
- Forces Excel to show the input prompt.
- TableName String
- 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:
DocumentParameters
- Document ExcelDocument
- Workbook to update outside the DSL context.
- ErrorMessage String
- Error message text. Omit or pass null to clear the message.
- ErrorTitle String
- Error title. Omit or pass null to clear the title.
- HeaderName String
- Header or table column name used to resolve the validation rules to update.
- HeaderRow Int32
- Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
- IncludeHeader SwitchParameter
- Include the header cell in the resolved range.
- PassThru SwitchParameter
- Returns matching validation rules after updating them.
- Prompt String
- Input prompt text. Omit or pass null to clear the prompt.
- PromptTitle String
- Input prompt title. Omit or pass null to clear the title.
- Range String
- A1 range used to select existing validation rules.
- Sheet String
- Worksheet name to update. Defaults to the current DSL sheet.
- SheetIndex Nullable`1
- Worksheet index (0-based) to update. Defaults to the current DSL sheet.
- ShowErrorMessage SwitchParameter
- Forces Excel to show the validation error.
- ShowInputMessage SwitchParameter
- Forces Excel to show the input prompt.
- TableName String
- Optional table name for header-based range resolution.
Outputs
System.Management.Automation.PSObject