1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2*8b0727e7Smseidel 3d33d0967SAndrew Rist<!--*********************************************************** 4*8b0727e7Smseidel * 5d33d0967SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 6d33d0967SAndrew Rist * or more contributor license agreements. See the NOTICE file 7d33d0967SAndrew Rist * distributed with this work for additional information 8d33d0967SAndrew Rist * regarding copyright ownership. The ASF licenses this file 9d33d0967SAndrew Rist * to you under the Apache License, Version 2.0 (the 10d33d0967SAndrew Rist * "License"); you may not use this file except in compliance 11d33d0967SAndrew Rist * with the License. You may obtain a copy of the License at 12*8b0727e7Smseidel * 13d33d0967SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 14*8b0727e7Smseidel * 15d33d0967SAndrew Rist * Unless required by applicable law or agreed to in writing, 16d33d0967SAndrew Rist * software distributed under the License is distributed on an 17d33d0967SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18d33d0967SAndrew Rist * KIND, either express or implied. See the License for the 19d33d0967SAndrew Rist * specific language governing permissions and limitations 20d33d0967SAndrew Rist * under the License. 21*8b0727e7Smseidel * 22d33d0967SAndrew Rist ***********************************************************--> 23d33d0967SAndrew Rist 24*8b0727e7Smseidel<helpdocument version="1.0"> 25cdf0e10cSrcweir<meta> 26*8b0727e7Smseidel<topic id="textsbasicshared01040000xml" indexer="include" status="PUBLISH"> 27*8b0727e7Smseidel<title xml-lang="en-US" id="tit">Event-Driven Macros</title> 28*8b0727e7Smseidel<filename>/text/sbasic/shared/01040000.xhp</filename> 29*8b0727e7Smseidel</topic> 30*8b0727e7Smseidel</meta> 31*8b0727e7Smseidel<body> 32*8b0727e7Smseidel<section id="weitere"> 33*8b0727e7Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3154581"> 34*8b0727e7Smseidel<bookmark_value>deleting; macro assignments to events</bookmark_value> 35*8b0727e7Smseidel<bookmark_value>macros; assigning to events</bookmark_value> 36*8b0727e7Smseidel<bookmark_value>assigning macros to events</bookmark_value> 37*8b0727e7Smseidel<bookmark_value>events; assigning macros</bookmark_value> 38cdf0e10cSrcweir</bookmark> 39cdf0e10cSrcweir<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> 40*8b0727e7Smseidel<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> 41*8b0727e7Smseidel</section> 42*8b0727e7Smseidel<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> 43*8b0727e7Smseidel<table id="tbl_id3148646"> 44*8b0727e7Smseidel<tablerow> 45*8b0727e7Smseidel<tablecell> 46*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3148455" role="tablehead" l10n="U" oldref="5">Event</paragraph> 47*8b0727e7Smseidel</tablecell> 48*8b0727e7Smseidel<tablecell> 49*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3145799" role="tablehead" l10n="U" oldref="6">An assigned macro is executed...</paragraph> 50*8b0727e7Smseidel</tablecell> 51*8b0727e7Smseidel</tablerow> 52*8b0727e7Smseidel<tablerow> 53*8b0727e7Smseidel<tablecell> 54*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3149379" role="tablecontent" l10n="U" oldref="7">Program Start</paragraph> 55*8b0727e7Smseidel</tablecell> 56*8b0727e7Smseidel<tablecell> 57*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3150715" role="tablecontent" l10n="U" oldref="8">... after a $[officename] application is started.</paragraph> 58*8b0727e7Smseidel</tablecell> 59*8b0727e7Smseidel</tablerow> 60*8b0727e7Smseidel<tablerow> 61*8b0727e7Smseidel<tablecell> 62*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3146914" role="tablecontent" l10n="U" oldref="9">Program End</paragraph> 63*8b0727e7Smseidel</tablecell> 64*8b0727e7Smseidel<tablecell> 65*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3153765" role="tablecontent" l10n="U" oldref="10">...before a $[officename] application is terminated.</paragraph> 66*8b0727e7Smseidel</tablecell> 67*8b0727e7Smseidel</tablerow> 68*8b0727e7Smseidel<tablerow> 69*8b0727e7Smseidel<tablecell> 70*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3145150" role="tablecontent" l10n="U" oldref="11">Create Document</paragraph> 71*8b0727e7Smseidel</tablecell> 72*8b0727e7Smseidel<tablecell> 73*8b0727e7Smseidel<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> 74*8b0727e7Smseidel</tablecell> 75*8b0727e7Smseidel</tablerow> 76*8b0727e7Smseidel<tablerow> 77*8b0727e7Smseidel<tablecell> 78*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3145790" role="tablecontent" l10n="U" oldref="13">Open Document</paragraph> 79*8b0727e7Smseidel</tablecell> 80*8b0727e7Smseidel<tablecell> 81*8b0727e7Smseidel<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> 82*8b0727e7Smseidel</tablecell> 83*8b0727e7Smseidel</tablerow> 84*8b0727e7Smseidel<tablerow> 85*8b0727e7Smseidel<tablecell> 86*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3153266" role="tablecontent" l10n="U" oldref="15">Save Document As</paragraph> 87*8b0727e7Smseidel</tablecell> 88*8b0727e7Smseidel<tablecell> 89*8b0727e7Smseidel<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> 90*8b0727e7Smseidel</tablecell> 91*8b0727e7Smseidel</tablerow> 92*8b0727e7Smseidel<tablerow> 93*8b0727e7Smseidel<tablecell> 94*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3158215" role="tablecontent" l10n="U" oldref="43">Document has been saved as</paragraph> 95*8b0727e7Smseidel</tablecell> 96*8b0727e7Smseidel<tablecell> 97*8b0727e7Smseidel<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> 98*8b0727e7Smseidel</tablecell> 99*8b0727e7Smseidel</tablerow> 100*8b0727e7Smseidel<tablerow> 101*8b0727e7Smseidel<tablecell> 102*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3150519" role="tablecontent" l10n="U" oldref="17">Save Document</paragraph> 103*8b0727e7Smseidel</tablecell> 104*8b0727e7Smseidel<tablecell> 105*8b0727e7Smseidel<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> 106*8b0727e7Smseidel</tablecell> 107*8b0727e7Smseidel</tablerow> 108*8b0727e7Smseidel<tablerow> 109*8b0727e7Smseidel<tablecell> 110*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3149404" role="tablecontent" l10n="U" oldref="45">Document has been saved</paragraph> 111*8b0727e7Smseidel</tablecell> 112*8b0727e7Smseidel<tablecell> 113*8b0727e7Smseidel<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> 114*8b0727e7Smseidel</tablecell> 115*8b0727e7Smseidel</tablerow> 116*8b0727e7Smseidel<tablerow> 117*8b0727e7Smseidel<tablecell> 118*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3159171" role="tablecontent" l10n="CHG" oldref="19">Document is closing<comment>i104852</comment></paragraph> 119*8b0727e7Smseidel</tablecell> 120*8b0727e7Smseidel<tablecell> 121*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3146868" role="tablecontent" l10n="U" oldref="20">...before a document is closed.</paragraph> 122*8b0727e7Smseidel</tablecell> 123*8b0727e7Smseidel</tablerow> 124*8b0727e7Smseidel<tablerow> 125*8b0727e7Smseidel<tablecell> 126*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3159097" role="tablecontent" l10n="CHG" oldref="47">Document closed</paragraph> 127*8b0727e7Smseidel</tablecell> 128*8b0727e7Smseidel<tablecell> 129*8b0727e7Smseidel<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> 130*8b0727e7Smseidel</tablecell> 131*8b0727e7Smseidel</tablerow> 132*8b0727e7Smseidel<tablerow> 133*8b0727e7Smseidel<tablecell> 134*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3144772" role="tablecontent" l10n="U" oldref="21">Activate Document</paragraph> 135*8b0727e7Smseidel</tablecell> 136*8b0727e7Smseidel<tablecell> 137*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3149442" role="tablecontent" l10n="U" oldref="22">...after a document is brought to the foreground.</paragraph> 138*8b0727e7Smseidel</tablecell> 139*8b0727e7Smseidel</tablerow> 140*8b0727e7Smseidel<tablerow> 141*8b0727e7Smseidel<tablecell> 142*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3150888" role="tablecontent" l10n="U" oldref="23">Deactivate Document</paragraph> 143*8b0727e7Smseidel</tablecell> 144*8b0727e7Smseidel<tablecell> 145*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3154060" role="tablecontent" l10n="U" oldref="24">...after another document is brought to the foreground.</paragraph> 146*8b0727e7Smseidel</tablecell> 147*8b0727e7Smseidel</tablerow> 148*8b0727e7Smseidel<tablerow> 149*8b0727e7Smseidel<tablecell> 150*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3152384" role="tablecontent" l10n="U" oldref="25">Print Document</paragraph> 151*8b0727e7Smseidel</tablecell> 152*8b0727e7Smseidel<tablecell> 153*8b0727e7Smseidel<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> 154*8b0727e7Smseidel</tablecell> 155*8b0727e7Smseidel</tablerow> 156*8b0727e7Smseidel<tablerow> 157*8b0727e7Smseidel<tablecell> 158*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3159227" role="tablecontent" l10n="U" oldref="49">JavaScript run-time error</paragraph> 159*8b0727e7Smseidel</tablecell> 160*8b0727e7Smseidel<tablecell> 161*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3145362" role="tablecontent" l10n="U" oldref="50">...when a JavaScript run-time error occurs.</paragraph> 162*8b0727e7Smseidel</tablecell> 163*8b0727e7Smseidel</tablerow> 164*8b0727e7Smseidel<tablerow> 165*8b0727e7Smseidel<tablecell> 166*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3154767" role="tablecontent" l10n="U" oldref="27">Print Mail Merge</paragraph> 167*8b0727e7Smseidel</tablecell> 168*8b0727e7Smseidel<tablecell> 169*8b0727e7Smseidel<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> 170*8b0727e7Smseidel</tablecell> 171*8b0727e7Smseidel</tablerow> 172*8b0727e7Smseidel<tablerow> 173*8b0727e7Smseidel<tablecell> 174*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3156366" role="tablecontent" l10n="U" oldref="51">Change of the page count</paragraph> 175*8b0727e7Smseidel</tablecell> 176*8b0727e7Smseidel<tablecell> 177*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3154627" role="tablecontent" l10n="U" oldref="52">...when the page count changes.</paragraph> 178*8b0727e7Smseidel</tablecell> 179*8b0727e7Smseidel</tablerow> 180*8b0727e7Smseidel<tablerow> 181*8b0727e7Smseidel<tablecell> 182*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3154737" role="tablecontent" l10n="U" oldref="53">Message received</paragraph> 183*8b0727e7Smseidel</tablecell> 184*8b0727e7Smseidel<tablecell> 185*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3150952" role="tablecontent" l10n="U" oldref="54">...if a message was received.</paragraph> 186*8b0727e7Smseidel</tablecell> 187*8b0727e7Smseidel</tablerow> 188*8b0727e7Smseidel</table> 189*8b0727e7Smseidel<paragraph xml-lang="en-US" id="hd_id3153299" role="heading" level="2" l10n="U" 190*8b0727e7Smseideloldref="30">Assigning a Macro to an Event</paragraph> 191*8b0727e7Smseidel<list type="ordered"> 192*8b0727e7Smseidel<listitem> 193*8b0727e7Smseidel<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> 194*8b0727e7Smseidel</listitem> 195*8b0727e7Smseidel<listitem> 196*8b0727e7Smseidel<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> 197*8b0727e7Smseidel</listitem> 198*8b0727e7Smseidel<listitem> 199*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3150431" role="listitem" l10n="U" oldref="32">Select the event from the <emph>Event</emph> list.</paragraph> 200*8b0727e7Smseidel</listitem> 201*8b0727e7Smseidel<listitem> 202*8b0727e7Smseidel<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> 203*8b0727e7Smseidel</listitem> 204*8b0727e7Smseidel<listitem> 205*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3146321" role="listitem" l10n="CHG" oldref="35">Click <emph>OK</emph> to assign the macro.</paragraph> 206*8b0727e7Smseidel</listitem> 207*8b0727e7Smseidel<listitem> 208*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3147414" role="listitem" l10n="U" oldref="56">Click <emph>OK</emph> to close the dialog.</paragraph> 209*8b0727e7Smseidel</listitem> 210*8b0727e7Smseidel</list> 211*8b0727e7Smseidel<paragraph xml-lang="en-US" id="hd_id3154581" role="heading" level="2" l10n="U" 212*8b0727e7Smseideloldref="36">Removing the Assignment of a Macro to an Event</paragraph> 213*8b0727e7Smseidel<list type="ordered"> 214*8b0727e7Smseidel<listitem> 215*8b0727e7Smseidel<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> 216*8b0727e7Smseidel</listitem> 217*8b0727e7Smseidel<listitem> 218*8b0727e7Smseidel<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> 219*8b0727e7Smseidel</listitem> 220*8b0727e7Smseidel<listitem> 221*8b0727e7Smseidel<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> 222*8b0727e7Smseidel</listitem> 223*8b0727e7Smseidel<listitem> 224*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3149143" role="listitem" l10n="U" oldref="37">Click <emph>Remove</emph>.</paragraph> 225*8b0727e7Smseidel</listitem> 226*8b0727e7Smseidel<listitem> 227*8b0727e7Smseidel<paragraph xml-lang="en-US" id="par_id3149351" role="listitem" l10n="U" oldref="60">Click <emph>OK</emph> to close the dialog.</paragraph> 228*8b0727e7Smseidel</listitem> 229*8b0727e7Smseidel</list> 230*8b0727e7Smseidel</body> 231*8b0727e7Smseidel</helpdocument> 232