ID: Q96923
The information in this article applies to:
You can change printer driver settings such as resolution, paper orientation, and paper size with a Microsoft WordBasic macro that includes the SendKeys command.
When you are using the SendKeys command, and there is no active printer, you will receive the following error message:
WordBasic Err = 102, Command Failed
If no default printer has been set or no printer is active, a macro that uses the SendKeys command to access a printer driver in Word version 1.x for Windows will cause an unrecoverable application error (UAE) (if you are using Microsoft Windows version 3.0) or a general protection (GP) fault (if you are using Windows version 3.1).
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.
The SendKeys command should only be used to change settings that are not available in the Page Setup dialog box (from the Format menu, choose Page Setup) of Word version 2.0 for Windows. For example, the following macro automates the process of changing the duplex option in the HP LaserJet IIISi printer driver:
Sub MAIN
SendKeys "%o", - 1 'Options button
SendKeys "%l{enter}{enter}", - 1 'chooses long side and OK button
FilePrintSetup .Printer = "HP LaserJet IIISi on LPT1:", .Setup
End Sub
"Using WordBasic" by WexTech Systems, Inc. and Microsoft Corporation, Microsoft Press, 1992.
KBCategory: KBSubcategory: kbmacro Additional query words: winword2 send keys 1.0 1.10 word6 winword 7.0 word95 word7 1.10a 2.0 2.0a 2.0a-CD 2.0b 2.0c 6.0 6.0a 6.0c
Keywords : kbmacro kbprint
Version : 1.x 2.x 6.0 6.0a 6.0c 7.0
Platform : WINDOWS
Last Reviewed: February 5, 1998