Collabora Office 23.05 帮助
Defines the error message that is displayed when invalid data is entered in a cell.
您还可以启动一个显示错误信息的宏。此页面的结尾处提供了一个示例宏。
当单元格中输入了无效的数据时,将显示「内容」区域中输入的错误消息。 如果已启用此选项,将显示该消息以避免输入无效数据。
对于这两种情况,如果选择「停止」,将删除无效的条目且单元格被重新输入以前的数值。如果您点击「取消」按钮关闭了「警告」和「信息」对话框,也将执行相同的操作。如果您按下「确定」按钮关闭对话框,则不会删除无效的条目。
选择单元格中输入无效数据时要执行的操作。「停止」操作将拒绝无效的输入并显示一个对话框,必须点击「确定才能关闭该对话框。「警告」和「信息」操作将显示一个对话框,点击「确定」或「取消」可关闭该对话框,但只有点击取消」才能拒绝无效的输入。
打开宏对话框,可以从中选择一个宏,以便当单元格中输入无效数据时执行该宏。显示错误报告后将执行宏。
输入宏标题,或输入单元格中出现无效数据时要显示的错误消息。
输入单元格中出现无效数据时要显示的消息。
Below is a sample function that can be called when an error occurs. Note that the macro takes in two parameters that are passed on by Collabora Office when the function is called:
CellValue: The value entered by the user, as a String.
CellAddress: The address of the cell where the value was entered, as a String prefixed with the sheet name (e.g: "Sheet1.A1").
The function must return a Boolean value. If it returns True, the entered value is kept. If the function returns False, the entered value is erased and the previous value is restored.
Function ExampleValidity(CellValue as String, CellAddress as String) as Boolean
Dim msg as String
Dim iAnswer as Integer
Dim MB_FLAGS as Integer
msg = "Invalid value: " & "'" & CellValue & "'"
msg = msg & " in cell: " & "'" & CellAddress & "'"
msg = msg & Chr(10) & "Accept anyway?"
MB_FLAGS = MB_YESNO + MB_ICONEXCLAMATION + MB_DEFBUTTON2
iAnswer = MsgBox (msg , MB_FLAGS, "Error message")
ExampleValidity = (iAnswer = IDYES)
End Function