1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2cdf0e10cSrcweir 3d33d0967SAndrew Rist<!--*********************************************************** 4cdf0e10cSrcweir * 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 12cdf0e10cSrcweir * 13d33d0967SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 14cdf0e10cSrcweir * 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. 21cdf0e10cSrcweir * 22d33d0967SAndrew Rist ***********************************************************--> 23d33d0967SAndrew Rist 245b00253eSmseidel<helpdocument version="1.0"> 25cdf0e10cSrcweir<meta> 26cdf0e10cSrcweir<topic id="textsbasicshared01040000xml" indexer="include" status="PUBLISH"> 27cdf0e10cSrcweir<title xml-lang="en-US" id="tit">Event-Driven Macros</title> 28cdf0e10cSrcweir<filename>/text/sbasic/shared/01040000.xhp</filename> 29cdf0e10cSrcweir</topic> 30cdf0e10cSrcweir</meta> 31cdf0e10cSrcweir<body> 32cdf0e10cSrcweir<section id="weitere"> 335b00253eSmseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3154581"> 345b00253eSmseidel<bookmark_value>deleting; macro assignments to events</bookmark_value> 35cdf0e10cSrcweir<bookmark_value>macros; assigning to events</bookmark_value> 36cdf0e10cSrcweir<bookmark_value>assigning macros to events</bookmark_value> 37cdf0e10cSrcweir<bookmark_value>events; assigning macros</bookmark_value> 38cdf0e10cSrcweir</bookmark> 39*66de63a7Smseidel<paragraph xml-lang="en-US" id="hd_id3147348" role="heading" level="1" l10n="U"><link href="text/sbasic/shared/01040000.xhp" name="Event-Driven Macros">Event-Driven Macros</link></paragraph> 40*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3146120" role="paragraph" l10n="U">This section describes how to assign Basic programs to program events.</paragraph> 41cdf0e10cSrcweir</section> 42*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3149263" role="paragraph" l10n="U">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> 43cdf0e10cSrcweir<table id="tbl_id3148646"> 44cdf0e10cSrcweir<tablerow> 45cdf0e10cSrcweir<tablecell> 46*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3148455" role="tablehead" l10n="U">Event</paragraph> 47cdf0e10cSrcweir</tablecell> 48cdf0e10cSrcweir<tablecell> 49*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3145799" role="tablehead" l10n="U">An assigned macro is executed...</paragraph> 50cdf0e10cSrcweir</tablecell> 51cdf0e10cSrcweir</tablerow> 52cdf0e10cSrcweir<tablerow> 53cdf0e10cSrcweir<tablecell> 54*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3149379" role="tablecontent" l10n="U">Program Start</paragraph> 55cdf0e10cSrcweir</tablecell> 56cdf0e10cSrcweir<tablecell> 57*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3150715" role="tablecontent" l10n="U">... after a $[officename] application is started.</paragraph> 58cdf0e10cSrcweir</tablecell> 59cdf0e10cSrcweir</tablerow> 60cdf0e10cSrcweir<tablerow> 61cdf0e10cSrcweir<tablecell> 62*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3146914" role="tablecontent" l10n="U">Program End</paragraph> 63cdf0e10cSrcweir</tablecell> 64cdf0e10cSrcweir<tablecell> 65*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3153765" role="tablecontent" l10n="U">...before a $[officename] application is terminated.</paragraph> 66cdf0e10cSrcweir</tablecell> 67cdf0e10cSrcweir</tablerow> 68cdf0e10cSrcweir<tablerow> 69cdf0e10cSrcweir<tablecell> 70*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3145150" role="tablecontent" l10n="U">Create Document</paragraph> 71cdf0e10cSrcweir</tablecell> 72cdf0e10cSrcweir<tablecell> 73*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3163808" role="tablecontent" l10n="U">...after a new document is created with <emph>File - New</emph> or with the <emph>New</emph> icon.</paragraph> 74cdf0e10cSrcweir</tablecell> 75cdf0e10cSrcweir</tablerow> 76cdf0e10cSrcweir<tablerow> 77cdf0e10cSrcweir<tablecell> 78*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3145790" role="tablecontent" l10n="U">Open Document</paragraph> 79cdf0e10cSrcweir</tablecell> 80cdf0e10cSrcweir<tablecell> 81*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3154572" role="tablecontent" l10n="U">...after a document is opened with <emph>File - Open</emph> or with the <emph>Open</emph> icon.</paragraph> 82cdf0e10cSrcweir</tablecell> 83cdf0e10cSrcweir</tablerow> 84cdf0e10cSrcweir<tablerow> 85cdf0e10cSrcweir<tablecell> 86*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3153266" role="tablecontent" l10n="U">Save Document As</paragraph> 87cdf0e10cSrcweir</tablecell> 88cdf0e10cSrcweir<tablecell> 89*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3150208" role="tablecontent" l10n="U">...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> 90cdf0e10cSrcweir</tablecell> 91cdf0e10cSrcweir</tablerow> 92cdf0e10cSrcweir<tablerow> 93cdf0e10cSrcweir<tablecell> 94*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3158215" role="tablecontent" l10n="U">Document has been saved as</paragraph> 95cdf0e10cSrcweir</tablecell> 96cdf0e10cSrcweir<tablecell> 97*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3150980" role="tablecontent" l10n="U">... 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> 98cdf0e10cSrcweir</tablecell> 99cdf0e10cSrcweir</tablerow> 100cdf0e10cSrcweir<tablerow> 101cdf0e10cSrcweir<tablecell> 102*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3150519" role="tablecontent" l10n="U">Save Document</paragraph> 103cdf0e10cSrcweir</tablecell> 104cdf0e10cSrcweir<tablecell> 105*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3155529" role="tablecontent" l10n="U">...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> 106cdf0e10cSrcweir</tablecell> 107cdf0e10cSrcweir</tablerow> 108cdf0e10cSrcweir<tablerow> 109cdf0e10cSrcweir<tablecell> 110*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3149404" role="tablecontent" l10n="U">Document has been saved</paragraph> 111cdf0e10cSrcweir</tablecell> 112cdf0e10cSrcweir<tablecell> 113*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3151332" role="tablecontent" l10n="U">...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> 114cdf0e10cSrcweir</tablecell> 115cdf0e10cSrcweir</tablerow> 116cdf0e10cSrcweir<tablerow> 117cdf0e10cSrcweir<tablecell> 118*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3159171" role="tablecontent" l10n="CHG">Document is closing<comment>i104852</comment></paragraph> 119cdf0e10cSrcweir</tablecell> 120cdf0e10cSrcweir<tablecell> 121*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3146868" role="tablecontent" l10n="U">...before a document is closed.</paragraph> 122cdf0e10cSrcweir</tablecell> 123cdf0e10cSrcweir</tablerow> 124cdf0e10cSrcweir<tablerow> 125cdf0e10cSrcweir<tablecell> 126*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3159097" role="tablecontent" l10n="CHG">Document closed</paragraph> 127cdf0e10cSrcweir</tablecell> 128cdf0e10cSrcweir<tablecell> 129*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3148606" role="tablecontent" l10n="U">...after a document was closed. Note that the "Save Document" event may also occur when the document is saved before closing.</paragraph> 130cdf0e10cSrcweir</tablecell> 131cdf0e10cSrcweir</tablerow> 132cdf0e10cSrcweir<tablerow> 133cdf0e10cSrcweir<tablecell> 134*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3144772" role="tablecontent" l10n="U">Activate Document</paragraph> 135cdf0e10cSrcweir</tablecell> 136cdf0e10cSrcweir<tablecell> 137*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3149442" role="tablecontent" l10n="U">...after a document is brought to the foreground.</paragraph> 138cdf0e10cSrcweir</tablecell> 139cdf0e10cSrcweir</tablerow> 140cdf0e10cSrcweir<tablerow> 141cdf0e10cSrcweir<tablecell> 142*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3150888" role="tablecontent" l10n="U">Deactivate Document</paragraph> 143cdf0e10cSrcweir</tablecell> 144cdf0e10cSrcweir<tablecell> 145*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3154060" role="tablecontent" l10n="U">...after another document is brought to the foreground.</paragraph> 146cdf0e10cSrcweir</tablecell> 147cdf0e10cSrcweir</tablerow> 148cdf0e10cSrcweir<tablerow> 149cdf0e10cSrcweir<tablecell> 150*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3152384" role="tablecontent" l10n="U">Print Document</paragraph> 151cdf0e10cSrcweir</tablecell> 152cdf0e10cSrcweir<tablecell> 153*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3152873" role="tablecontent" l10n="U">...after the <emph>Print</emph> dialog is closed, but before the actual print process begins.</paragraph> 154cdf0e10cSrcweir</tablecell> 155cdf0e10cSrcweir</tablerow> 156cdf0e10cSrcweir<tablerow> 157cdf0e10cSrcweir<tablecell> 158*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3159227" role="tablecontent" l10n="U">JavaScript run-time error</paragraph> 159cdf0e10cSrcweir</tablecell> 160cdf0e10cSrcweir<tablecell> 161*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3145362" role="tablecontent" l10n="U">...when a JavaScript run-time error occurs.</paragraph> 162cdf0e10cSrcweir</tablecell> 163cdf0e10cSrcweir</tablerow> 164cdf0e10cSrcweir<tablerow> 165cdf0e10cSrcweir<tablecell> 166*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3154767" role="tablecontent" l10n="U">Print Mail Merge</paragraph> 167cdf0e10cSrcweir</tablecell> 168cdf0e10cSrcweir<tablecell> 169*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3153555" role="tablecontent" l10n="U">...after the <emph>Print</emph> dialog is closed, but before the actual print process begins. This event occurs for each copy printed.</paragraph> 170cdf0e10cSrcweir</tablecell> 171cdf0e10cSrcweir</tablerow> 172cdf0e10cSrcweir<tablerow> 173cdf0e10cSrcweir<tablecell> 174*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3156366" role="tablecontent" l10n="U">Change of the page count</paragraph> 175cdf0e10cSrcweir</tablecell> 176cdf0e10cSrcweir<tablecell> 177*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3154627" role="tablecontent" l10n="U">...when the page count changes.</paragraph> 178cdf0e10cSrcweir</tablecell> 179cdf0e10cSrcweir</tablerow> 180cdf0e10cSrcweir<tablerow> 181cdf0e10cSrcweir<tablecell> 182*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3154737" role="tablecontent" l10n="U">Message received</paragraph> 183cdf0e10cSrcweir</tablecell> 184cdf0e10cSrcweir<tablecell> 185*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3150952" role="tablecontent" l10n="U">...if a message was received.</paragraph> 186cdf0e10cSrcweir</tablecell> 187cdf0e10cSrcweir</tablerow> 188cdf0e10cSrcweir</table> 189*66de63a7Smseidel<paragraph xml-lang="en-US" id="hd_id3153299" role="heading" level="2" l10n="U">Assigning a Macro to an Event</paragraph> 190cdf0e10cSrcweir<list type="ordered"> 191cdf0e10cSrcweir<listitem> 192*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3147244" role="listitem" l10n="U">Choose <emph>Tools - Customize</emph> and click the <emph>Events</emph> tab.</paragraph> 193cdf0e10cSrcweir</listitem> 194cdf0e10cSrcweir<listitem> 195*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3146098" role="listitem" l10n="CHG">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> 196cdf0e10cSrcweir</listitem> 197cdf0e10cSrcweir<listitem> 198*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3150431" role="listitem" l10n="U">Select the event from the <emph>Event</emph> list.</paragraph> 199cdf0e10cSrcweir</listitem> 200cdf0e10cSrcweir<listitem> 201*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3148742" role="listitem" l10n="CHG">Click <emph>Macro</emph> and select the macro to be assigned to the selected event.</paragraph> 202cdf0e10cSrcweir</listitem> 203cdf0e10cSrcweir<listitem> 204*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3146321" role="listitem" l10n="CHG">Click <emph>OK</emph> to assign the macro.</paragraph> 205cdf0e10cSrcweir</listitem> 206cdf0e10cSrcweir<listitem> 207*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3147414" role="listitem" l10n="U">Click <emph>OK</emph> to close the dialog.</paragraph> 208cdf0e10cSrcweir</listitem> 209cdf0e10cSrcweir</list> 210*66de63a7Smseidel<paragraph xml-lang="en-US" id="hd_id3154581" role="heading" level="2" l10n="U">Removing the Assignment of a Macro to an Event</paragraph> 211cdf0e10cSrcweir<list type="ordered"> 212cdf0e10cSrcweir<listitem> 213*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3146883" role="listitem" l10n="U">Choose <emph>Tools - Customize</emph> and click the <emph>Events</emph> tab.</paragraph> 214cdf0e10cSrcweir</listitem> 215cdf0e10cSrcweir<listitem> 216*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3155909" role="listitem" l10n="CHG">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> 217cdf0e10cSrcweir</listitem> 218cdf0e10cSrcweir<listitem> 219*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3159129" role="listitem" l10n="U">Select the event that contains the assignment to be removed from the <emph>Event</emph> list.</paragraph> 220cdf0e10cSrcweir</listitem> 221cdf0e10cSrcweir<listitem> 222*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3149143" role="listitem" l10n="U">Click <emph>Remove</emph>.</paragraph> 223cdf0e10cSrcweir</listitem> 224cdf0e10cSrcweir<listitem> 225*66de63a7Smseidel<paragraph xml-lang="en-US" id="par_id3149351" role="listitem" l10n="U">Click <emph>OK</emph> to close the dialog.</paragraph> 226cdf0e10cSrcweir</listitem> 227cdf0e10cSrcweir</list> 228cdf0e10cSrcweir</body> 229cdf0e10cSrcweir</helpdocument> 230