Excel: Using a Macro to Change the Font in a Header

Last reviewed: November 2, 1994
Article ID: Q59619

SUMMARY

To change the font name in a header or footer through a macro, double sets of quotation marks ("") must be included around the font name because Microsoft Excel's PAGE.SETUP function requires the actual quotation marks to be present.

For example, to set the font size to 24 points and the font to Helvetica with no footer, type the following command (where "This is a Header in Helvetica" is the header text):

   =PAGE.SETUP("&24&""Helvetica""This is a Header in Helvetica","")

MORE INFORMATION

An alternative to using the double quotation marks is to concatenate a CHAR(34) (the quotation mark character) around the font name. For example:

   =PAGE.SETUP("&24&"&CHAR(34)&"Helvetica"&CHAR(34)&"This is a Header
   in Helvetica","")

Fore more information on the PAGE.SETUP command function, see pages 173-175 in the "Microsoft Excel Function Reference" version 3.0 manual. If you are using Excel 2.20, see page 257 in the "Microsoft Excel Function and Macros" version 2.2 manual.

For more information on quotation marks in a macro text string, query on the following words:

   quotation and marks and text and string and macro


KBCategory: kbother
KBSubcategory:

Additional reference words: noupd


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: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.