Using a Macro to Select Font Cartridges (60326)



The information in this article applies to:

  • Microsoft Excel for Windows 2.0
  • Microsoft Excel for Windows 2.01
  • Microsoft Excel for Windows 2.1
  • Microsoft Excel for Windows 2.10c
  • Microsoft Excel for Windows 2.10d
  • Microsoft Excel for Windows 3.0
  • Microsoft Excel for Windows 4.0
  • Microsoft Excel for Windows 5.0

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 "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.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbcode kbmacro kbProgramming KB60326