返回或设置数据有效性检验错误消息。 读/写 String。
语法
表达式。ErrorMessage
表达 一个代表 Validation 对象的变量。
示例
本示例向单元格 E5 添加数据有效性检验,并指定输入信息和错误消息。
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
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。