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