1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2*5b00253eSmseidel 3d33d0967SAndrew Rist<!--*********************************************************** 4*5b00253eSmseidel * 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*5b00253eSmseidel * 13d33d0967SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 14*5b00253eSmseidel * 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*5b00253eSmseidel * 22d33d0967SAndrew Rist ***********************************************************--> 23d33d0967SAndrew Rist 24*5b00253eSmseidel<helpdocument version="1.0"> 25cdf0e10cSrcweir<meta> 26*5b00253eSmseidel<topic id="textsbasicshared01040000xml" indexer="include" status="PUBLISH"> 27*5b00253eSmseidel<title xml-lang="en-US" id="tit">Event-Driven Macros</title> 28*5b00253eSmseidel<filename>/text/sbasic/shared/01040000.xhp</filename> 29*5b00253eSmseidel</topic> 30*5b00253eSmseidel</meta> 31*5b00253eSmseidel<body> 32*5b00253eSmseidel<section id="weitere"> 33*5b00253eSmseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3154581"> 34*5b00253eSmseidel<bookmark_value>deleting; macro assignments to events</bookmark_value> 35*5b00253eSmseidel<bookmark_value>macros; assigning to events</bookmark_value> 36*5b00253eSmseidel<bookmark_value>assigning macros to events</bookmark_value> 37*5b00253eSmseidel<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*5b00253eSmseidel<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*5b00253eSmseidel</section> 42*5b00253eSmseidel<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*5b00253eSmseidel<table id="tbl_id3148646"> 44*5b00253eSmseidel<tablerow> 45*5b00253eSmseidel<tablecell> 46*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3148455" role="tablehead" l10n="U" oldref="5">Event</paragraph> 47*5b00253eSmseidel</tablecell> 48*5b00253eSmseidel<tablecell> 49*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3145799" role="tablehead" l10n="U" oldref="6">An assigned macro is executed...</paragraph> 50*5b00253eSmseidel</tablecell> 51*5b00253eSmseidel</tablerow> 52*5b00253eSmseidel<tablerow> 53*5b00253eSmseidel<tablecell> 54*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3149379" role="tablecontent" l10n="U" oldref="7">Program Start</paragraph> 55*5b00253eSmseidel</tablecell> 56*5b00253eSmseidel<tablecell> 57*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3150715" role="tablecontent" l10n="U" oldref="8">... after a $[officename] application is started.</paragraph> 58*5b00253eSmseidel</tablecell> 59*5b00253eSmseidel</tablerow> 60*5b00253eSmseidel<tablerow> 61*5b00253eSmseidel<tablecell> 62*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3146914" role="tablecontent" l10n="U" oldref="9">Program End</paragraph> 63*5b00253eSmseidel</tablecell> 64*5b00253eSmseidel<tablecell> 65*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3153765" role="tablecontent" l10n="U" oldref="10">...before a $[officename] application is terminated.</paragraph> 66*5b00253eSmseidel</tablecell> 67*5b00253eSmseidel</tablerow> 68*5b00253eSmseidel<tablerow> 69*5b00253eSmseidel<tablecell> 70*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3145150" role="tablecontent" l10n="U" oldref="11">Create Document</paragraph> 71*5b00253eSmseidel</tablecell> 72*5b00253eSmseidel<tablecell> 73*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 75*5b00253eSmseidel</tablerow> 76*5b00253eSmseidel<tablerow> 77*5b00253eSmseidel<tablecell> 78*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3145790" role="tablecontent" l10n="U" oldref="13">Open Document</paragraph> 79*5b00253eSmseidel</tablecell> 80*5b00253eSmseidel<tablecell> 81*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 83*5b00253eSmseidel</tablerow> 84*5b00253eSmseidel<tablerow> 85*5b00253eSmseidel<tablecell> 86*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3153266" role="tablecontent" l10n="U" oldref="15">Save Document As</paragraph> 87*5b00253eSmseidel</tablecell> 88*5b00253eSmseidel<tablecell> 89*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 91*5b00253eSmseidel</tablerow> 92*5b00253eSmseidel<tablerow> 93*5b00253eSmseidel<tablecell> 94*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3158215" role="tablecontent" l10n="U" oldref="43">Document has been saved as</paragraph> 95*5b00253eSmseidel</tablecell> 96*5b00253eSmseidel<tablecell> 97*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 99*5b00253eSmseidel</tablerow> 100*5b00253eSmseidel<tablerow> 101*5b00253eSmseidel<tablecell> 102*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3150519" role="tablecontent" l10n="U" oldref="17">Save Document</paragraph> 103*5b00253eSmseidel</tablecell> 104*5b00253eSmseidel<tablecell> 105*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 107*5b00253eSmseidel</tablerow> 108*5b00253eSmseidel<tablerow> 109*5b00253eSmseidel<tablecell> 110*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3149404" role="tablecontent" l10n="U" oldref="45">Document has been saved</paragraph> 111*5b00253eSmseidel</tablecell> 112*5b00253eSmseidel<tablecell> 113*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 115*5b00253eSmseidel</tablerow> 116*5b00253eSmseidel<tablerow> 117*5b00253eSmseidel<tablecell> 118*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3159171" role="tablecontent" l10n="CHG" oldref="19">Document is closing<comment>i104852</comment></paragraph> 119*5b00253eSmseidel</tablecell> 120*5b00253eSmseidel<tablecell> 121*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3146868" role="tablecontent" l10n="U" oldref="20">...before a document is closed.</paragraph> 122*5b00253eSmseidel</tablecell> 123*5b00253eSmseidel</tablerow> 124*5b00253eSmseidel<tablerow> 125*5b00253eSmseidel<tablecell> 126*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3159097" role="tablecontent" l10n="CHG" oldref="47">Document closed</paragraph> 127*5b00253eSmseidel</tablecell> 128*5b00253eSmseidel<tablecell> 129*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 131*5b00253eSmseidel</tablerow> 132*5b00253eSmseidel<tablerow> 133*5b00253eSmseidel<tablecell> 134*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3144772" role="tablecontent" l10n="U" oldref="21">Activate Document</paragraph> 135*5b00253eSmseidel</tablecell> 136*5b00253eSmseidel<tablecell> 137*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3149442" role="tablecontent" l10n="U" oldref="22">...after a document is brought to the foreground.</paragraph> 138*5b00253eSmseidel</tablecell> 139*5b00253eSmseidel</tablerow> 140*5b00253eSmseidel<tablerow> 141*5b00253eSmseidel<tablecell> 142*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3150888" role="tablecontent" l10n="U" oldref="23">Deactivate Document</paragraph> 143*5b00253eSmseidel</tablecell> 144*5b00253eSmseidel<tablecell> 145*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3154060" role="tablecontent" l10n="U" oldref="24">...after another document is brought to the foreground.</paragraph> 146*5b00253eSmseidel</tablecell> 147*5b00253eSmseidel</tablerow> 148*5b00253eSmseidel<tablerow> 149*5b00253eSmseidel<tablecell> 150*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3152384" role="tablecontent" l10n="U" oldref="25">Print Document</paragraph> 151*5b00253eSmseidel</tablecell> 152*5b00253eSmseidel<tablecell> 153*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 155*5b00253eSmseidel</tablerow> 156*5b00253eSmseidel<tablerow> 157*5b00253eSmseidel<tablecell> 158*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3159227" role="tablecontent" l10n="U" oldref="49">JavaScript run-time error</paragraph> 159*5b00253eSmseidel</tablecell> 160*5b00253eSmseidel<tablecell> 161*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3145362" role="tablecontent" l10n="U" oldref="50">...when a JavaScript run-time error occurs.</paragraph> 162*5b00253eSmseidel</tablecell> 163*5b00253eSmseidel</tablerow> 164*5b00253eSmseidel<tablerow> 165*5b00253eSmseidel<tablecell> 166*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3154767" role="tablecontent" l10n="U" oldref="27">Print Mail Merge</paragraph> 167*5b00253eSmseidel</tablecell> 168*5b00253eSmseidel<tablecell> 169*5b00253eSmseidel<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*5b00253eSmseidel</tablecell> 171*5b00253eSmseidel</tablerow> 172*5b00253eSmseidel<tablerow> 173*5b00253eSmseidel<tablecell> 174*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3156366" role="tablecontent" l10n="U" oldref="51">Change of the page count</paragraph> 175*5b00253eSmseidel</tablecell> 176*5b00253eSmseidel<tablecell> 177*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3154627" role="tablecontent" l10n="U" oldref="52">...when the page count changes.</paragraph> 178*5b00253eSmseidel</tablecell> 179*5b00253eSmseidel</tablerow> 180*5b00253eSmseidel<tablerow> 181*5b00253eSmseidel<tablecell> 182*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3154737" role="tablecontent" l10n="U" oldref="53">Message received</paragraph> 183*5b00253eSmseidel</tablecell> 184*5b00253eSmseidel<tablecell> 185*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3150952" role="tablecontent" l10n="U" oldref="54">...if a message was received.</paragraph> 186*5b00253eSmseidel</tablecell> 187*5b00253eSmseidel</tablerow> 188*5b00253eSmseidel</table> 189*5b00253eSmseidel<paragraph xml-lang="en-US" id="hd_id3153299" role="heading" level="2" l10n="U" 190*5b00253eSmseideloldref="30">Assigning a Macro to an Event</paragraph> 191*5b00253eSmseidel<list type="ordered"> 192*5b00253eSmseidel<listitem> 193*5b00253eSmseidel<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*5b00253eSmseidel</listitem> 195*5b00253eSmseidel<listitem> 196*5b00253eSmseidel<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*5b00253eSmseidel</listitem> 198*5b00253eSmseidel<listitem> 199*5b00253eSmseidel<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*5b00253eSmseidel</listitem> 201*5b00253eSmseidel<listitem> 202*5b00253eSmseidel<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*5b00253eSmseidel</listitem> 204*5b00253eSmseidel<listitem> 205*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3146321" role="listitem" l10n="CHG" oldref="35">Click <emph>OK</emph> to assign the macro.</paragraph> 206*5b00253eSmseidel</listitem> 207*5b00253eSmseidel<listitem> 208*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3147414" role="listitem" l10n="U" oldref="56">Click <emph>OK</emph> to close the dialog.</paragraph> 209*5b00253eSmseidel</listitem> 210*5b00253eSmseidel</list> 211*5b00253eSmseidel<paragraph xml-lang="en-US" id="hd_id3154581" role="heading" level="2" l10n="U" 212*5b00253eSmseideloldref="36">Removing the Assignment of a Macro to an Event</paragraph> 213*5b00253eSmseidel<list type="ordered"> 214*5b00253eSmseidel<listitem> 215*5b00253eSmseidel<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*5b00253eSmseidel</listitem> 217*5b00253eSmseidel<listitem> 218*5b00253eSmseidel<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*5b00253eSmseidel</listitem> 220*5b00253eSmseidel<listitem> 221*5b00253eSmseidel<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*5b00253eSmseidel</listitem> 223*5b00253eSmseidel<listitem> 224*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3149143" role="listitem" l10n="U" oldref="37">Click <emph>Remove</emph>.</paragraph> 225*5b00253eSmseidel</listitem> 226*5b00253eSmseidel<listitem> 227*5b00253eSmseidel<paragraph xml-lang="en-US" id="par_id3149351" role="listitem" l10n="U" oldref="60">Click <emph>OK</emph> to close the dialog.</paragraph> 228*5b00253eSmseidel</listitem> 229*5b00253eSmseidel</list> 230*5b00253eSmseidel</body> 231*5b00253eSmseidel</helpdocument> 232