summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/scalc/01/12120300.xhp
blob: 4b0079d65866b0aca4470baa53bdb0cd847c7ffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->

<helpdocument version="1.0">
<meta>
  <topic id="textscalc0112120300xml" indexer="include" status="PUBLISH">
  <title id="tit" xml-lang="en-US">Error Alert</title>
    <filename>/text/scalc/01/12120300.xhp</filename>
  </topic>
  <history>
    <created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
  </history>
</meta>
<body>
<section id="error_alert">
  <bookmark xml-lang="en-US" branch="hid/modules/scalc/ui/erroralerttabpage/ErrorAlertTabPage" id="bm_id3156024" localize="false"/>
  <bookmark xml-lang="en-US" branch="hid/modules/scalc/ui/erroralerttabpage/@@nowidget@@" id="bm_id3156024" localize="false"/>
  <paragraph role="heading" id="hd_id3153821" xml-lang="en-US" level="1"><link href="text/scalc/01/12120300.xhp" name="Error Alert">Error Alert</link></paragraph>
  <paragraph role="paragraph" id="par_id3153379" xml-lang="en-US"><ahelp hid="modules/scalc/ui/erroralerttabpage/ErrorAlertTabPage">Defines the error message that is displayed when invalid data is entered in a cell.</ahelp></paragraph>
</section>
<paragraph role="paragraph" id="par_id3154138" xml-lang="en-US">You can also start a macro with an error message. A sample macro is provided at the end of this page.</paragraph>
<section id="howtoget">
  <embed href="text/scalc/00/00000412.xhp#datengueltigfehler"/>
</section>
<bookmark xml-lang="en-US" branch="hid/modules/scalc/ui/erroralerttabpage/tsbshow" id="bm_id3154908" localize="false"/>
<paragraph role="heading" id="hd_id3156280" xml-lang="en-US" level="2">Show error message when invalid values are entered.</paragraph>
<paragraph role="paragraph" id="par_id3150768" xml-lang="en-US"><ahelp hid=".">Displays the error message that you enter in the <emph>Contents</emph> area when invalid data is entered in a cell.</ahelp> If enabled, the message is displayed to prevent an invalid entry.</paragraph>
<paragraph role="paragraph" id="par_id3146984" xml-lang="en-US">In both cases, if you select "Stop", the invalid entry is deleted and the previous value is reentered in the cell. The same applies if you close the "Warning" and "Information" dialogs by clicking the <emph>Cancel </emph>button. If you close the dialogs with the <emph>OK</emph> button, the invalid entry is not deleted.</paragraph>
<paragraph role="heading" id="hd_id3152460" xml-lang="en-US" level="2">Contents</paragraph>
<bookmark xml-lang="en-US" branch="hid/modules/scalc/ui/erroralerttabpage/actionCB" id="bm_id3154014" localize="false"/>
<paragraph role="heading" id="hd_id3148646" xml-lang="en-US" level="3">Action</paragraph>
<paragraph role="paragraph" id="par_id3151115" xml-lang="en-US"><ahelp hid="modules/scalc/ui/erroralerttabpage/actionCB">Select the action that you want to occur when invalid data is entered in a cell.</ahelp> The "Stop" action rejects the invalid entry and displays a dialog that you have to close by clicking <emph>OK</emph>. The "Warning" and "Information" actions display a dialog that can be closed by clicking <emph>OK</emph> or <emph>Cancel</emph>. The invalid entry is only rejected when you click <emph>Cancel</emph>.</paragraph>
<bookmark xml-lang="en-US" branch="hid/modules/scalc/ui/erroralerttabpage/browseBtn" id="bm_id3154729" localize="false"/>
<paragraph role="heading" id="hd_id3156441" xml-lang="en-US" level="3">Browse</paragraph>
<paragraph role="paragraph" id="par_id3153160" xml-lang="en-US"><ahelp hid="modules/scalc/ui/erroralerttabpage/browseBtn">Opens the <link href="text/shared/01/06130000.xhp" name="Macro">Macro</link> dialog where you can select the macro that is executed when invalid data is entered in a cell. The macro is executed after the error message is displayed.</ahelp></paragraph>
<bookmark xml-lang="en-US" branch="hid/modules/scalc/ui/erroralerttabpage/title" id="bm_id3149958" localize="false"/>
<paragraph role="heading" id="hd_id3153876" xml-lang="en-US" level="3">Title</paragraph>
<paragraph role="paragraph" id="par_id3149410" xml-lang="en-US"><ahelp hid="modules/scalc/ui/erroralerttabpage/title">Enter the title of the macro or the error message that you want to display when invalid data is entered in a cell.</ahelp></paragraph>
<bookmark xml-lang="en-US" branch="hid/modules/scalc/ui/erroralerttabpage/errorMsg" id="bm_id3153836" localize="false"/>
<paragraph role="heading" id="hd_id3154510" xml-lang="en-US" level="3">Error message</paragraph>
<paragraph role="paragraph" id="par_id3149122" xml-lang="en-US"><ahelp hid="modules/scalc/ui/erroralerttabpage/errorMsg">Enter the message that you want to display when invalid data is entered in a cell.</ahelp></paragraph>
  <h3 id="hd_id881545240342781">Sample macro:</h3>
  <paragraph role="paragraph" id="par_id521625929022780">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 %PRODUCTNAME when the function is called:</paragraph>
  <list type="unordered">
    <listitem>
        <paragraph id="par_id981625929097216" role="listitem"><emph>CellValue</emph>: The value entered by the user, as a String.</paragraph>
    </listitem>
    <listitem>
        <paragraph id="par_id421625929100152" role="listitem"><emph>CellAddress</emph>: The address of the cell where the value was entered, as a String prefixed with the sheet name (e.g: "Sheet1.A1").</paragraph>
    </listitem>
  </list>
  <paragraph role="paragraph" id="par_id101625929384030">The function must return a Boolean value. If it returns <literal>True</literal>, the entered value is kept. If the function returns <literal>False</literal>, the entered value is erased and the previous value is restored.</paragraph>
  <bascode>
    <paragraph role="bascode" localize="false" id="par_id31545240174027">Function ExampleValidity(CellValue as String, CellAddress as String) as Boolean</paragraph>
    <paragraph role="bascode" localize="false" id="par_id341545240202382">    Dim msg as String</paragraph>
    <paragraph role="bascode" localize="false" id="par_id11545240206618">    Dim iAnswer as Integer</paragraph>
    <paragraph role="bascode" localize="false" id="par_id841545240210171">    Dim MB_FLAGS as Integer</paragraph>
    <paragraph role="bascode" id="par_id531545240216611">    msg = "Invalid value: " &amp; "'" &amp; CellValue &amp; "'"</paragraph>
    <paragraph role="bascode" id="bas_id971625928577365">    msg = msg &amp; " in cell: " &amp; "'" &amp; CellAddress &amp; "'"</paragraph>
    <paragraph role="bascode" id="bas_id181625928577640">    msg = msg &amp; Chr(10) &amp; "Accept anyway?"</paragraph>
    <paragraph role="bascode" localize="false" id="bas_id711625928577798">    MB_FLAGS = MB_YESNO + MB_ICONEXCLAMATION + MB_DEFBUTTON2</paragraph>
    <paragraph role="bascode" id="bas_id941625928578118">    iAnswer = MsgBox (msg , MB_FLAGS, "Error message")</paragraph>
    <paragraph role="bascode" localize="false" id="bas_id11625928661345">    ExampleValidity = (iAnswer = IDYES)</paragraph>
    <paragraph role="bascode" localize="false" id="par_id971545240220293">End Function</paragraph>
  </bascode>
</body>
</helpdocument>