Document Level Events

BarTender supports the execution of VBScript in response to a variety of document-level events, including open, close, save, and a number of print-time events. You can call the Object Automation functions from within this VBScript to modify an object on your template before and even during print jobs.

ClosedTo enable VBScripting for document-level events

  1. From BarTender's File menu, select BarTender Document Options to open the BarTender Document Options dialog.

  2. Click the Scripting tab.

  3. Check the Enable document level script events check box.

  4. Select the event you'd like to edit.

  5. Click Edit to open the Script Editor.

If you already have the Script Editor open, you can modify a document-level event by selecting it in the Script pane.

BarTender does not support automation for data entry controls. If you attempt to use an Object property in a data entry script (such as the OnPrePrompt or OnPostPrompt events), BarTender will return an error and your script will fail to execute.

Available Document Event Scripts

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.

BarTender supports the following document events:

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.