Microsoft KB Archive/60326

= Using a Macro to Select Font Cartridges =

Article ID: 60326

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Excel 2.0 Standard Edition
 * Microsoft Excel 2.01
 * Microsoft Excel 2.1 Standard Edition
 * Microsoft Excel 2.10c
 * Microsoft Excel 2.10d
 * Microsoft Excel 3.0 Standard Edition
 * Microsoft Excel 4.0 Standard Edition
 * Microsoft Excel 5.0 Standard Edition

-



This article was previously published under Q60326



SUMMARY
In Microsoft Excel, the procedure that you use to change your font cartridge with a macro is not the same in Microsoft Windows/386 and Microsoft Windows versions 3.0 and 3.1.

Microsoft Windows versions 3.0 and 3.1 use a Control Panel that is different than the one used in Microsoft Windows/386. Because of this, the macro that you use for Microsoft Windows/386 is slightly different than the macro that you use for Microsoft Windows versions 3.0 and 3.1.



MORE INFORMATION
The information below makes the following assumptions:


 * 1) The Hewlett-Packard (HP) LaserJet printer has already been selected as the default printer.
 * 2) The macro below changes the settings from Microsoft Excel when you are using Microsoft Windows version 3.0 or 3.1.

Microsoft provides examples of Visual Basic procedures 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 Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. Note that a line that is preceded by an apostrophe introduces a comment in the code--comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line continuation character. For more information about Visual Basic for Applications programming style, see the &quot;Programming Style in This Manual&quot; section in the &quot;Document Conventions&quot; section of the &quot;Visual Basic User's Guide.&quot;

Visual Basic Procedure
Sub Cartridge_Macro ' Value in quotation marks should be replaced with ' the desired printer that appears in the Printer Setup dialog box Application.ActivePrinter = &quot;HP LaserJet Series II on LPT1:&quot; Application.SendKeys &quot;%(f)(p)(r)%(s)%(t)(a){032}(b){032}{esc}&quot; End Sub

Microsoft Excel version 4.0 Macro
A1: CartridgeMacro

A2: =SEND.KEYS(&quot;%(s)%(t)(a){032}&quot;)

A3: =PRINTER.SETUP?

A4: =RETURN

If you open your Printer Setup dialog box after running this macro, you will see that cartridge &quot;A&quot; is selected. To select a cartridge other than &quot;A&quot;, use the letter of that cartridge in place of &quot;A&quot;. The &quot;{032}&quot; is the ASCII code sequence for the SPACEBAR. To select two cartridges, modify the SEND.KEYS line read

=SEND.KEYS(&quot;%(s)%(t)(a){032}(b){032}&quot;)

where &quot;b&quot; is the second cartridge selected.

Additional query words: 2.00 2.01 2.10 3.00 4.00 5.00

Keywords: kbcode kbmacro kbprogramming KB60326

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.