1<?xml version="1.0" encoding="UTF-8"?>
2<helpdocument version="1.0">
3
4<!--
5***********************************************************************
6 *
7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 *
9 * Copyright 2000, 2010 Oracle and/or its affiliates.
10 *
11 * OpenOffice.org - a multi-platform office productivity suite
12 *
13 * This file is part of OpenOffice.org.
14 *
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
18 *
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
24 *
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org.  If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
29 *
30 ************************************************************************
31 -->
32
33
34<meta>
35      <topic id="textsbasicshared01040000xml" indexer="include" status="PUBLISH">
36         <title xml-lang="en-US" id="tit">Event-Driven Macros</title>
37         <filename>/text/sbasic/shared/01040000.xhp</filename>
38      </topic>
39   </meta>
40   <body>
41      <section id="weitere">
42<bookmark xml-lang="en-US" branch="index" id="bm_id3154581"><bookmark_value>deleting; macro assignments to events</bookmark_value>
43         <bookmark_value>macros; assigning to events</bookmark_value>
44         <bookmark_value>assigning macros to events</bookmark_value>
45         <bookmark_value>events; assigning macros</bookmark_value>
46</bookmark>
47<paragraph xml-lang="en-US" id="hd_id3147348" role="heading" level="1" l10n="U" oldref="1"><link href="text/sbasic/shared/01040000.xhp" name="Event-Driven Macros">Event-Driven Macros</link></paragraph>
48         <paragraph xml-lang="en-US" id="par_id3146120" role="paragraph" l10n="U" oldref="2">This section describes how to assign Basic programs to program events.</paragraph>
49      </section>
50      <paragraph xml-lang="en-US" id="par_id3149263" role="paragraph" l10n="U" oldref="4">You can automatically execute a macro when a specified software event occurs by assigning the desired macro to the event. The following table provides an overview of program events and at what point an assigned macro is executed.</paragraph>
51      <table id="tbl_id3148646">
52         <tablerow>
53            <tablecell>
54               <paragraph xml-lang="en-US" id="par_id3148455" role="tablehead" l10n="U" oldref="5">Event</paragraph>
55            </tablecell>
56            <tablecell>
57               <paragraph xml-lang="en-US" id="par_id3145799" role="tablehead" l10n="U" oldref="6">An assigned macro is executed...</paragraph>
58            </tablecell>
59         </tablerow>
60         <tablerow>
61            <tablecell>
62               <paragraph xml-lang="en-US" id="par_id3149379" role="tablecontent" l10n="U" oldref="7">Program Start</paragraph>
63            </tablecell>
64            <tablecell>
65               <paragraph xml-lang="en-US" id="par_id3150715" role="tablecontent" l10n="U" oldref="8">... after a $[officename] application is started.</paragraph>
66            </tablecell>
67         </tablerow>
68         <tablerow>
69            <tablecell>
70               <paragraph xml-lang="en-US" id="par_id3146914" role="tablecontent" l10n="U" oldref="9">Program End</paragraph>
71            </tablecell>
72            <tablecell>
73               <paragraph xml-lang="en-US" id="par_id3153765" role="tablecontent" l10n="U" oldref="10">...before a $[officename] application is terminated.</paragraph>
74            </tablecell>
75         </tablerow>
76         <tablerow>
77            <tablecell>
78               <paragraph xml-lang="en-US" id="par_id3145150" role="tablecontent" l10n="U" oldref="11">Create Document</paragraph>
79            </tablecell>
80            <tablecell>
81               <paragraph xml-lang="en-US" id="par_id3163808" role="tablecontent" l10n="U" oldref="12">...after a new document is created with <emph>File - New</emph> or with the <emph>New</emph> icon.</paragraph>
82            </tablecell>
83         </tablerow>
84         <tablerow>
85            <tablecell>
86               <paragraph xml-lang="en-US" id="par_id3145790" role="tablecontent" l10n="U" oldref="13">Open Document</paragraph>
87            </tablecell>
88            <tablecell>
89               <paragraph xml-lang="en-US" id="par_id3154572" role="tablecontent" l10n="U" oldref="14">...after a document is opened with <emph>File - Open</emph> or with the <emph>Open</emph> icon.</paragraph>
90            </tablecell>
91         </tablerow>
92         <tablerow>
93            <tablecell>
94               <paragraph xml-lang="en-US" id="par_id3153266" role="tablecontent" l10n="U" oldref="15">Save Document As</paragraph>
95            </tablecell>
96            <tablecell>
97               <paragraph xml-lang="en-US" id="par_id3150208" role="tablecontent" l10n="U" oldref="16">...before a document is saved under a specified name (with <emph>File - Save As</emph>, or with <emph>File - Save</emph> or the <emph>Save</emph> icon, if a document name has not yet been specified).</paragraph>
98            </tablecell>
99         </tablerow>
100         <tablerow>
101            <tablecell>
102               <paragraph xml-lang="en-US" id="par_id3158215" role="tablecontent" l10n="U" oldref="43">Document has been saved as</paragraph>
103            </tablecell>
104            <tablecell>
105               <paragraph xml-lang="en-US" id="par_id3150980" role="tablecontent" l10n="U" oldref="44">... after a document was saved under a specified name (with <emph>File - Save As</emph>, or with <emph>File - Save</emph> or with the <emph>Save</emph> icon, if a document name has not yet been specified).</paragraph>
106            </tablecell>
107         </tablerow>
108         <tablerow>
109            <tablecell>
110               <paragraph xml-lang="en-US" id="par_id3150519" role="tablecontent" l10n="U" oldref="17">Save Document</paragraph>
111            </tablecell>
112            <tablecell>
113               <paragraph xml-lang="en-US" id="par_id3155529" role="tablecontent" l10n="U" oldref="18">...before a document is saved with <emph>File - Save</emph> or the <emph>Save</emph> icon, provided that a document name has already been specified.</paragraph>
114            </tablecell>
115         </tablerow>
116         <tablerow>
117            <tablecell>
118               <paragraph xml-lang="en-US" id="par_id3149404" role="tablecontent" l10n="U" oldref="45">Document has been saved</paragraph>
119            </tablecell>
120            <tablecell>
121               <paragraph xml-lang="en-US" id="par_id3151332" role="tablecontent" l10n="U" oldref="46">...after a document is saved with <emph>File - Save</emph> or the <emph>Save</emph> icon, provided that a document name has already been specified.</paragraph>
122            </tablecell>
123         </tablerow>
124         <tablerow>
125            <tablecell>
126               <paragraph xml-lang="en-US" id="par_id3159171" role="tablecontent" l10n="CHG" oldref="19">Document is closing<comment>i104852</comment></paragraph>
127            </tablecell>
128            <tablecell>
129               <paragraph xml-lang="en-US" id="par_id3146868" role="tablecontent" l10n="U" oldref="20">...before a document is closed.</paragraph>
130            </tablecell>
131         </tablerow>
132         <tablerow>
133            <tablecell>
134               <paragraph xml-lang="en-US" id="par_id3159097" role="tablecontent" l10n="CHG" oldref="47">Document closed</paragraph>
135            </tablecell>
136            <tablecell>
137               <paragraph xml-lang="en-US" id="par_id3148606" role="tablecontent" l10n="U" oldref="48">...after a document was closed. Note that the "Save Document" event may also occur when the document is saved before closing.</paragraph>
138            </tablecell>
139         </tablerow>
140         <tablerow>
141            <tablecell>
142               <paragraph xml-lang="en-US" id="par_id3144772" role="tablecontent" l10n="U" oldref="21">Activate Document</paragraph>
143            </tablecell>
144            <tablecell>
145               <paragraph xml-lang="en-US" id="par_id3149442" role="tablecontent" l10n="U" oldref="22">...after a document is brought to the foreground.</paragraph>
146            </tablecell>
147         </tablerow>
148         <tablerow>
149            <tablecell>
150               <paragraph xml-lang="en-US" id="par_id3150888" role="tablecontent" l10n="U" oldref="23">Deactivate Document</paragraph>
151            </tablecell>
152            <tablecell>
153               <paragraph xml-lang="en-US" id="par_id3154060" role="tablecontent" l10n="U" oldref="24">...after another document is brought to the foreground.</paragraph>
154            </tablecell>
155         </tablerow>
156         <tablerow>
157            <tablecell>
158               <paragraph xml-lang="en-US" id="par_id3152384" role="tablecontent" l10n="U" oldref="25">Print Document</paragraph>
159            </tablecell>
160            <tablecell>
161               <paragraph xml-lang="en-US" id="par_id3152873" role="tablecontent" l10n="U" oldref="26">...after the <emph>Print</emph> dialog is closed, but before the actual print process begins.</paragraph>
162            </tablecell>
163         </tablerow>
164         <tablerow>
165            <tablecell>
166               <paragraph xml-lang="en-US" id="par_id3159227" role="tablecontent" l10n="U" oldref="49">JavaScript run-time error</paragraph>
167            </tablecell>
168            <tablecell>
169               <paragraph xml-lang="en-US" id="par_id3145362" role="tablecontent" l10n="U" oldref="50">...when a JavaScript run-time error occurs.</paragraph>
170            </tablecell>
171         </tablerow>
172         <tablerow>
173            <tablecell>
174               <paragraph xml-lang="en-US" id="par_id3154767" role="tablecontent" l10n="U" oldref="27">Print Mail Merge</paragraph>
175            </tablecell>
176            <tablecell>
177               <paragraph xml-lang="en-US" id="par_id3153555" role="tablecontent" l10n="U" oldref="28">...after the <emph>Print</emph> dialog is closed, but before the actual print process begins. This event occurs for each copy printed.</paragraph>
178            </tablecell>
179         </tablerow>
180         <tablerow>
181            <tablecell>
182               <paragraph xml-lang="en-US" id="par_id3156366" role="tablecontent" l10n="U" oldref="51">Change of the page count</paragraph>
183            </tablecell>
184            <tablecell>
185               <paragraph xml-lang="en-US" id="par_id3154627" role="tablecontent" l10n="U" oldref="52">...when the page count changes.</paragraph>
186            </tablecell>
187         </tablerow>
188         <tablerow>
189            <tablecell>
190               <paragraph xml-lang="en-US" id="par_id3154737" role="tablecontent" l10n="U" oldref="53">Message received</paragraph>
191            </tablecell>
192            <tablecell>
193               <paragraph xml-lang="en-US" id="par_id3150952" role="tablecontent" l10n="U" oldref="54">...if a message was received.</paragraph>
194            </tablecell>
195         </tablerow>
196      </table>
197
198      <paragraph xml-lang="en-US" id="hd_id3153299" role="heading" level="2" l10n="U"
199                 oldref="30">Assigning a Macro to an Event</paragraph>
200      <list type="ordered">
201         <listitem>
202            <paragraph xml-lang="en-US" id="par_id3147244" role="listitem" l10n="U" oldref="31">Choose <emph>Tools - Customize</emph> and click the <emph>Events</emph> tab.</paragraph>
203         </listitem>
204         <listitem>
205            <paragraph xml-lang="en-US" id="par_id3146098" role="listitem" l10n="CHG" oldref="55">Select whether you want the assignment to be globally valid or just valid in the current document in the <emph>Save In</emph> listbox.</paragraph>
206         </listitem>
207         <listitem>
208            <paragraph xml-lang="en-US" id="par_id3150431" role="listitem" l10n="U" oldref="32">Select the event from the <emph>Event</emph> list.</paragraph>
209         </listitem>
210         <listitem>
211            <paragraph xml-lang="en-US" id="par_id3148742" role="listitem" l10n="CHG" oldref="33">Click <emph>Macro</emph> and select the macro to be assigned to the selected event.</paragraph>
212         </listitem>
213         <listitem>
214            <paragraph xml-lang="en-US" id="par_id3146321" role="listitem" l10n="CHG" oldref="35">Click <emph>OK</emph> to assign the macro.</paragraph>
215         </listitem>
216         <listitem>
217            <paragraph xml-lang="en-US" id="par_id3147414" role="listitem" l10n="U" oldref="56">Click <emph>OK</emph> to close the dialog.</paragraph>
218         </listitem>
219      </list>
220      <paragraph xml-lang="en-US" id="hd_id3154581" role="heading" level="2" l10n="U"
221                 oldref="36">Removing the Assignment of a Macro to an Event</paragraph>
222      <list type="ordered">
223         <listitem>
224            <paragraph xml-lang="en-US" id="par_id3146883" role="listitem" l10n="U" oldref="57">Choose <emph>Tools - Customize</emph> and click the <emph>Events</emph> tab.</paragraph>
225         </listitem>
226         <listitem>
227            <paragraph xml-lang="en-US" id="par_id3155909" role="listitem" l10n="CHG" oldref="58">Select whether you want to remove a global assignment or an assignment that is just valid in the current document by selecting the option in the <emph>Save In</emph> listbox.</paragraph>
228         </listitem>
229         <listitem>
230            <paragraph xml-lang="en-US" id="par_id3159129" role="listitem" l10n="U" oldref="59">Select the event that contains the assignment to be removed from the <emph>Event</emph> list.</paragraph>
231         </listitem>
232         <listitem>
233            <paragraph xml-lang="en-US" id="par_id3149143" role="listitem" l10n="U" oldref="37">Click <emph>Remove</emph>.</paragraph>
234         </listitem>
235         <listitem>
236            <paragraph xml-lang="en-US" id="par_id3149351" role="listitem" l10n="U" oldref="60">Click <emph>OK</emph> to close the dialog.</paragraph>
237         </listitem>
238      </list>
239   </body>
240</helpdocument>