Microsoft KB Archive/122709

= How to Create a Macro to Change Printer or Fax Driver =

Article ID: 122709

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 95a

-



This article was previously published under Q122709



SUMMARY
This article describes how to create a macro that allows you to send a document to a specific printer or fax device and then resets the printer to the original default. If you have several printers or if you want to switch between a printer and a fax driver, create multiple macros.



MORE INFORMATION
The following macro example selects the "HP LaserJet IIISi on LPT1:" and then returns you to your default printer. Sub MAIN 'Retrieve and set information about the current default printer Dim FPS As FilePrintSetup GetCurValues FPS 'Set the default Printer DefaultPrinter$ = FPS.Printer FilePrintSetup .Printer = "HP LaserJet IIISi on LPT1:" 'Send the document to the currently selected printer FilePrint 'Reset to the original default printer FilePrintSetup .Printer = DefaultPrinter$ End Sub If you have more than one printer, you can create one macro for each printer and change the name of the printer to reflect the printer you are using. Make sure the text exactly matches the printer description. To obtain this information, click Print on the File menu and then choose the Printer button.

To create the macro:


 * 1) On the Tools menu, click Macro.
 * 2) Type a macro name, such as PrintToFax (without any spaces), and click Edit. A macro editing window will appear.
 * 3) Type the lines shown above between the Sub MAIN and End Sub lines.
 * 4) Click Close and save your changes to the macro.

Once you create the macro, you can use the Customize command (on the Tools menu) to assign the macro to a keystroke, menu, or toolbar button.

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

