LibreOffice 25.2 žinynas
Defines the error message that is displayed when invalid data is entered in a cell.
Klaidos pranešimu galite pradėti makrokomandą. Šio puslapio pabaigoje pateikiamas makrokomandos pavyzdys.
Įvedus neteisingą reikšmę parodo klaidos pranešimą, kurį įvedėte srityje Turinys. Jei parinkti įjungta, tai pranešimas parodomas norint išvengti klaidingos įvesties.
Abiem atvejais, pasirinus „Baigti“, neteisingas įrašas ištrinamas ir atkuriama ankstesnė langelio reikšmė. Taip pat įvyks, jei užversite „Pranešimo“ arba „Informacijos“ dialogo langus spustelėję Atšaukti. Jei užversite dialogo langus spustelėję Gerai, tai neteisinga įvestis paliekama.
Pasirinkite veiksmą, kuris turi būti įvykdytas įvedus neteisingą reikšmę į langelį. Veiksmas „Baigti“ atšaukia neteisingą įvestį ir atveria dialogo langą, kurį turite užverti spustelėję Gerai. Veiksmai „Pranešimas“ ir „informacija“ atveria dialogo langą, kuris gali būti užvertas spustelėjus Gerai arba Atšaukti. Netinkamos įvestys atšaukiamos tik kai spustelite Atšaukti.
Atveria Makrokomandos dialogo langą, kuriame galite pasirinkti makrokomandą, kuri įvykdoma, kai langelyje įvedama neteisinga įvestis. Komanda pritaikoma po to, kai parodomas klaidos pranešimas.
Įveskite makrokomandos pavadinimą arba klaidos pranešimą, kurį norite parodyti, kai langelyje įvedama neteisinga įvestis.
Įrašykite pranešimą, kurį norite parodyti, kai langelyje įvedama neteisinga įvestis.
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