Microsoft KB Archive/69614

{|
 * width="100%"|

Using SEND.KEYS to Change Paper Source in Printer Setup

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0

-

SUMMARY
The following macro will change the paper source to &quot;lower tray&quot; on the Helwett-Packard (HP) LaserJet IIP:

  A1: =SEND.KEYS(&quot;%(S)~%(S){PGUP}{DOWN}&quot;) A2: =PRINTER.SETUP? A3: =RETURN

This macro sends keystrokes to the Printer Setup dialog box. The following is an explanation of the string used in the SEND.KEYS function:

  Command        Description ---       ---

%(S)          Chooses Setup ~             Chooses OK (Excel 3.00 only, see below **) %(S)          Selects &quot;paper source&quot; {PGUP}        Moves selection to the top to choose &quot;upper tray&quot; {DOWN}        Moves selection down one time to choose &quot;lower tray&quot; Chooses OK twice to enter the changes.


 * This is only needed in Microsoft Excel version 3.0 with printers that support extended printer attributes accessible in Page Setup from the File menu. Epson printer drivers, for example, do not support these attributes; therefore, the tilde is not necessary. If you are not sure if your printer has these attributes, you can manually choose Printer Setup from the File menu and choose the setup button. If a dialog box is displayed with the following message, you need the tilde:

"This command controls default printer settings for all documents and all applications. Use File Page Setup to set Orientation, Paper Size, and Scaling for individual documents."

MORE INFORMATION
In the Printer Setup dialog box, there is no accelerator key combination that will directly select a paper source such as &quot;lower tray.&quot; Instead, the arrow keys should be used to select from the list of sources available. On the HP LaserJet IIP, for example, there are four possible choices for the paper source:


 * Upper tray
 * Lower tray
 * Manual feed
 * Envelope

The problem is that the current selection is unknown. The following may be the easiest way to select the right choice from the paper source list:

 Assume that the current selection is not known. To change that assumption, select the first source (&quot;upper tray&quot;). PGUP will guarantee that &quot;upper tray&quot; is selected.

Use &quot;{PGUP}&quot; (without the quotation marks) in the SEND.KEYS string.  Note how many times you want to use the {DOWN} string. The following is an example:

     none                 for &quot;Upper tray&quot; {DOWN}              for &quot;Lower tray&quot; (DOWN){DOWN)        for &quot;Manual feed&quot;      {DOWN}{DOWN}{DOWN}   for &quot;Envelope&quot; 