Open topic with navigation
Document Level Events
To enable VBScripting for document-level events
Click the Scripting tab.
Check the Enable document level script events check box.
Select the event you'd like to edit.
Click Edit to open the Script Editor.
All of the available Document Event Scripts are listed under Document Events in the Script pane. When you select an event and create a script in the Editor pane, the script will execute when the event occurs. For example, if you select OnOpen and write a script for it, that script will execute when the document is opened.
OnOpen: Executes the script when the document is opened.
OnSave: Executes the script when the document is saved.
OnClose: Executes the script when the document is closed.
OnPrintJobStart: Executes the script when you send your document to the printer.
OnIdenticalCopies: Executes the script for every printed item, even if it is a copy.
OnPrintJobEnd: Executes the script at the completion of a print job.
OnPrintJobCancel: Executes the script when a print job is cancelled before it is completed.
Although Procedures for Document Events appears in the Script pane under Document Events, it is not really an event at all. This item is a collection of Visual Basic Script functions and subroutines (that you write) which can be used by the scripts that you create for genuine document events, as listed above. For more information, refer to Procedures.