Associate Printer With Document

Home Up Search This Site What's New? Audio On CDR Favourites Downloadable files Photo Gallery 2002 Photo Gallery 2003 Photo Gallery 2004/5 Photo Gallery 2006/7 Photo Gallery 2008 UK Photo Gallery Ireland Photo Gallery Cats Photo Gallery 

 

 

Google
 

 

 

There is no charge for using any of the material (for personal use) on this web site, but if you wish to make a contribution to the ever growing running costs, any donation would be much appreciated. Click the adjacent button to access PayPal

Associate a particular printer with a document.

 

Word does not store information about the specific printer intended to print the document, and as the current printer to a large extent determines the formatting of the document, it would be useful to be able to store this information and set the active printer to the printer stored in the document.

The companion web page Print to a specific printer demonstrates how to select individual printers without affecting the default. This page provides simple tools to store the preferred printer in the document's properties and to print to the named printed without affecting the default printer.

The functions incorporate vba routines borrowed from the MVPS.ORG web site - specifically http://word.mvps.org/FAQs/MacrosVBA/AvailablePrinters.htm and http://word.mvps.org/faqs/macrosvba/MixedDocProps.htm to list the installed printers and to write to custom document properties - and are offered in the form of an add-in which you can download.

Using the add-in

 

The add-in is packaged in a standard ZIP format containing a document template, which should be extracted to the Word Startup folder. This folder is defined in Word at Tools > Options > File Locations > Startup or in Word 2007 - Word Options > Advanced > File Locations > Startup.

On starting Word the add-in presents a toolbar. In Word 2007 it adds two entries to the Add-Ins tab (if no other add-ins were installed, the Add-Ins tab would not previously have been displayed).

 

The first option 'Associate Printer with Document' reads the list of available printers from Windows and presents them in a numbered list (see illustration below). The currently active printer is offered as the default number in the text input area.

Note:

Because of the varying length of printer names, this function is configured to read only the first 8 characters, to determine the active printer name. If two or more printers have very similar names, it will be the last matching printer number which is shown, which may not be the currently active printer.

 

If the indicated printer number is not the printer to be associated with the document, change the number to the corresponding number. If you enter a number outside the range of available printers you will see an error message.

 

The function then writes the printer name to a custom document property 'Printer' and pops up a message of confirmation.

 

Custom document properties may be accessed in Word versions before 2007 from the File menu.

 

... and in Word 2007 from Word Options > Prepare > Document Properties > Advanced Properties

 

 

In both versions, the following dialog shows the entry below

Printing the document

 

While it would be possible to intercept the print command, I prefer to offer a separate command to print to the printer indicated in the custom property field. The second command on the toolbar looks for the custom property entry and, if it contains a printer name, will check whether that printer is available.

 

If there is no custom printer property of the named printer is not available, it offers the opportunity to print to the active printer or to cancel. The macro finally reports your choice of action.