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