ErrorMessage 属性 (Excel)Validation.ErrorMessage property (Excel)

返回或设置数据有效性检验错误消息。Returns or sets the data validation error message. 读/写 StringRead/write String.



_表达式_一个代表**验证** 对象的变量。expression A variable that represents a Validation object.


本示例向单元格 E5 添加数据有效性检验,并指定输入信息和错误消息。This example adds data validation to cell E5 and specifies both the input and error messages.

With Range("e5").Validation 
 .Add Type:=xlValidateWholeNumber, _ 
 AlertStyle:= xlValidAlertStop, _ 
 Operator:=xlBetween, Formula1:="5", Formula2:="10" 
 .InputTitle = "Integers" 
 .ErrorTitle = "Integers" 
 .InputMessage = "Enter an integer from five to ten" 
 .ErrorMessage = "You must enter a number from five to ten" 
End With

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.