|
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 modified versions of 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 pair of document templates, There are two versions - one
for Word 2003 (which will work with Word 2007 and 2010) and another for
Word 2010 which should work with both 32 and 64 bit versions.
Extract only the appropriate version
to
the Word Startup folder. This folder is defined in Word at Tools > Options >
File Locations > Startup, in Word 2007 at Word Options >
Advanced > File Locations > Startup.and in Word 2010 at
File > Options > Advanced > File Locations > Startup
On starting Word the add-in presents a
toolbar. In Word 2007/2010 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). |
| Note: |
The illustrations are from the Word 2010 version. The
alternative version is more basic (but functionally similar) but uses
vba message boxes instead of user forms. |
|

|
|
|
The first
option 'Associate Document with a Printer' 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 selection. If a printer is already associated with the
document, the associated printer is offered as the default selection. If
the associated printer is not available, no printer is offered as the
selection.
|
|


|
|
|
The
function then writes the printer name to a custom document property
'Printer'. Custom document properties (and a whole
lot of other stuff) are best viewed with the
Bookmarks and Variables etc
add-in. |
|
|
If Cancel
is selected, a message indicates whether the document will be printed to
the active printer or the associated printer dependent on whether there
is an associated printer and that it is available for use. |
  |
|
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. |
|
  
|