Triggering macros from templates
You can play a macro as you use a template. For example, if you use a template to create letters, you can set a PRE PRINT
trigger in the template that runs a spell-check macro. The macro then lets you check the spelling of your letters just before they print.
You can use the following macro triggers.
Adding the TemplateFill macro command
The TemplateFill() macro command displays a dialog box that lets you enter template data. This dialog box varies depending on the fields required for the current template. If personal information is not specified, this command first prompts you to specify personal information regardless of what data the current template requires. If the current template does not require data other than personal information, and the personal information has been set, this command updates the personal information in the document without displaying the dialog box. If the current document is not based on an automated template, and the personal information has been set, this command does nothing.
Only macros that have been added to the template can be used with triggers. A trigger specifies when a macro plays in a template (for example, before you close a document).
Macros on disk cannot be associated with a trigger. Running the Prompt Builder associates the POST NEW
trigger with <dofiller>, the feature that runs the Prompts dialog box. If the POST NEW
trigger is associated with a template macro, use the TemplateFill() macro command in that template macro to activate the DoFiller feature.
If you want DoFiller to run when you are using a template macro, you need to add the TemplateFill macro command. The position of this command is important because macro execution is generally sequential. For example, if you want to insert a macro in a template that adds a date code to your document, you need to let the macro place the date code prior to your filling out the template prompts.
To insert a macro trigger in a template |
1.
|
|
Click File New from project.
|
2.
|
|
Choose a template from the Project list.
|
3.
|
|
Click Options Edit WP template.
|
4.
|
|
Click Associate on the Template toolbar.
|
5.
|
|
Enable the Triggers option.
|
6.
|
|
Choose a trigger from the Items to associate list.
|
7.
|
|
From the Macros list box, choose the macro you want to associate with the trigger.
|
•
|
|
Only template macros that you have created in that template or copied to that template display in the Macros list box.
|
To add the TemplateFill macro command |
1.
|
|
Click Tools Macro Edit.
|
2.
|
|
Double-click a filename.
|
3.
|
|
Press Ctrl + End to place the cursor at the end of the macro document.
|
4.
|
|
Press Enter.
|
5.
|
|
Type
TemplateFill() . |
6.
|
|
Click Save & compile on the Template macro toolbar.
|
7.
|
|
Choose the drive and folder where you want to save the macro.
|
8.
|
|
Type the filename in the Filename box.
|
9.
|
|
Click Options Close macro on the Template macro toolbar.
|