Using a Macro to Select Font Cartridges

Last reviewed: September 2, 1997
Article ID: Q60326

The information in this article applies to:
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0

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 "Programming Style in This Manual" section in the "Document Conventions" section of the "Visual Basic User's Guide."

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 = "HP LaserJet Series II on LPT1:"
      Application.SendKeys "%(f)(p)(r)%(s)%(t)(a){032}(b){032}~~{esc}"
   End Sub

Microsoft Excel version 4.0 Macro

   A1:    CartridgeMacro
   A2:    =SEND.KEYS("%(s)%(t)(a){032}~~")
   A3:    =PRINTER.SETUP?()
   A4:    =RETURN()

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

   =SEND.KEYS("%(s)%(t)(a){032}(b){032}~~")

where "b" is the second cartridge selected.

Additional Query Words: 2.00 2.01 2.10 3.00 4.00 5.00

Keywords          : kbcode kbmacro kbprg
Version           : 2.x 3.00 4.00 5.00
Platform          : WINDOWS


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.