The information in this article applies to:
SUMMARY
It is possible to change the default paper source used by printer drivers
in Windows 95 by using the SendKeys command within a Visual Basic for
Applications subroutine in Microsoft Excel versions 7.0 and 97.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspThe SendKeys command in Visual Basic for Applications allows you to simulate the pressing of keys while a macro is running. By using the correct combination of keystrokes, you can accomplish many tasks that are not possible through normal macro commands. For example, if you need a subroutine to display the "About Microsoft Excel" dialog box, you could use the following command: SendKeys "%ha"In this example, "%h" is equivalent to pressing ALT+H, which activates the Help menu. The "a" is equivalent to selecting the "About Microsoft Excel" menu item. You can change the paper source used by a Windows 95 printer driver by using commands similar to the following:
In the SendKeys command, the following actions are executed.
The xSource variable contains a letter that determines what paper source
is used. Depending on the value you use (usually "a," "u," "m," or "l"),
the SendKeys statement selects the appropriate paper source, and then
simulates two presses of the ENTER key to accept the changes.
If you know you will always be switching to a particular paper source, you don't have to use the xSource variable. For example, the following command will always switch to the Manual Feed paper source:
For information on using SEND.KEYS with earlier versions of Microsoft
Excel, please see the following article in the Microsoft Knowledge Base:
Q69614 Using SEND.KEYS() to Change Paper Source in Printer Setup Additional query words: 8.00 97 xl97 send.keys() application
Keywords : kbprg kbprint kbdta kbdtacode KbVBA xlprint |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |