| Associating a Macro with a Trigger |
| For example, suppose you want to remind yourself to change to bond paper before printing a document created from a certain template. You've created a small template macro to display the reminder: |
| MessageBox(;"Reminder";"Remember to use bond paper") |
| If you name this template macro Reminder, here's how to run it automatically before printing a document created using the template where Reminder is stored: |
| With the template open for editing, click the button labeled Associate... . |
| Click the radio button labeled Triggers. |
| Select the Pre Print trigger from the list box on the left of the dialog. |
| Their will be a drop down edit box labeled Macros. Select the template macro named Reminder from the lis. |
| Click OK and close the template, saving changes made. |
| Every time you send a document to the printer, you will be reminded to use bond paper before the document is printed. If you had associated the macro with the Post Print trigger, you would be reminded too late. |
| Keep in mind that if you use one of the pre-event triggers like Pre Print, you cannot stop that event from happening (short of turning off the printer). |
| A Special Case: The Post New Trigger |
| If you want to run a macro on the occurrence of creating a new document, you would use a Post New trigger. If the template uses template prompts, you'll have to slightly modify any macro associated with the Post New trigger. |
| Open the template macro for editing and insert the macro command TemplateFill() into the template macro. This will invoke the Prompts dialog box and insert the prompts. Without the TemplateFill() command, the prompts will not run. |
| Normally, you'll want to use the TemplateFill() command at the beginning of the template macro but you may occasionally find it useful to place the TemplateFill() command somewhere else in the template macro. The prompts dialog box will be invoked wherever you insert the TemplateFill() command. |