We have 14 guests online

Search r3uk.com

Home
POLICE.DOT the process printing macro produced for Thames Valley Police


Before looking at this page, be sure to read the blurb on the nightmare that is paper tray selection when trying to automate printing from Windows.


Once the TVP Print macro had been sorted, I found that Thames Valley Police had another printing problem with their Process system - a database application which ran via a terminal emulator.

The way Process printed documents was to perform a MailMerge between a Word template and data source. If the user chose to customise it then the merge would be successful leaving the user with the opened merged document on the screen which could then be edited or printed.

The problem arose when the user chose not to customise the document. This would cause the macro in the document to execute the following line:

WordBasic.MailMergeToPrinter

This malfunctioned because the MailMergeToPrinter instruction tries to use Word Constants for paper tray numbering which are not valid with the Windows 2000 printer drivers. Instead, the functions of TVP Print needed to be adapted to allow the macro to find out what printer it's talking to, allowing it to set up it's paper trays correctly.

This can be done by using GetBinNumbers to find the available paper trays before handling the merge as below:

WordBasic.MailMergeToDoc
GetBinNumbers
With ActiveDocument.PageSetup
.FirstPageTray = trayheaded
.OtherPagesTray = trayplain
End With
Options.PrintBackground = False
ActiveDocument.PrintOut
WordBasic.FileExit 2

Using this code, the document is mailmerged within Word before being dumped to the correct printer trays as specified in GetBinNumbers. Word then quits, closing all open documents without saving changes.

The same changes were applied to LETTER.DOT, a template used for the same purpose by the Cedar application.

Download a zipped copy of the POLICE.DOT Process template here.

Download a zipped copy of the LETTER.DOT Cedar template here.

Download a zipped copy of the Normal.DOT template containing the TVP Print macro code here.

Download a zipped copy of Normal.DOT (version 3.7a) containing these macros along with its readme file and a Word file containing this information here.

 

Return to parent article