LibreOffice 26.2 Help
Defines the error message that is displayed when invalid data is entered in a cell.
Bạn cũng có thể khởi chạy một vĩ lệnh bằng một thông điệp lỗi. Một vĩ lệnh mẫu được cung cấp ở kết thúc của trang này.
Displays the error message that you enter in the Contents area when invalid data is entered in a cell. If enabled, the message is displayed to prevent an invalid entry.
Trong cả hai trường hợp, mục nhập sai bị xoá và giá trị trước được nhập lại vào ô. Cũng vậy nếu bạn đóng hộp thoại « Cảnh báo » và « Thông tin » bằng cách nhấn nút Thôi. Nếu bạn đóng hộp thoại bằng nút OK, mục nhập sai không bị xoá.
Select the action that you want to occur when invalid data is entered in a cell.
Mở hộp thoại Vĩ lệnh trong đó bạn có thể lựa chọn vĩ lệnh cần thực hiện khi dữ liệu sai được nhập vào ô. Vĩ lệnh được thực hiện một khi thông điệp lỗi được hiển thị.
Hãy nhập tựa đề của vĩ lệnh hay thông điệp bạn muốn hiển thị khi dữ liệu sai được nhập vào ô.
Hãy nhập thông điệp bạn muốn hiển thị khi dữ liệu sai được nhập vào ô.
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 LibreOffice 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