Microsoft KB Archive/59839

Macro to Change Standard Font PSS ID Number: Q59839 Article last modified on 06-23-1993 PSS database name: W_eXceL

2.20

OS/2

Summary:

You can change the standard font in Excel for OS/2 using macro below. This macro is named START.XLM so that it will automatically open when Excel for OS/2 is started.

More Information:

The sheet has user-defined auto_open and auto_close command macros to execute when applicable. The change_font command macro is executed whenever a new window is opened. Cell A12 contains an ALERT dialog that will prompt you to change the standard font for this sheet. If you answer OK to this alert message, the standard font will, for example, be changed to Times Roman 14 point bold for the sheet.

A - 1 |Auto_Open 2 |=ACTIVATE(“START.XLM”) 3 |=HIDE 4 |=SET.NAME(“var”,1) 5 |=ON.WINDOW(,START.XLM!Change_Font) 6 |=RETURN 7 | 8 |Change_Font 9 |=IF(GET.DOCUMENT(3)=2,GOTO(A14)) 10|=IF(COLUMNS(WINDOWS)=var,RETURN) 11|=IF(COLUMNS(WINDOWS)=var-1,GOTO(A14)) 12|=ALERT(“Apply Standard Font to This Sheet?”,1) 13|=IF(A12,STANDARD.FONT(“Tms Rmn”,14,TRUE)) 14|=SET.NAME(“var”,COLUMNS(WINDOWS)) 15|=IF(var=2,SET.NAME(“var”,1)) 16|=RETURN 17| 18|Auto_Close 19|=ON.WINDOW 20|=RETURN

This sheet hides itself on startup, but you may want to hide it permanently by saving it while hidden.

The macro prompts you only once per sheet to change the font. The alert message can be omitted, if you prefer, by deleting line A12 and changing A13 to eliminate the IF statement. Eliminating this choice may adversely affect any predefined fonts that are on the sheet.

For more information on automatically opening files in Microsoft Excel for OS/2, as well as auto_open and auto_close macros, see Page 609 of the “Microsoft Excel Reference” guide and Page 193 of the “Microsoft Excel Functions and Macros” manual (both the Version 2.2 manuals for Excel for OS/2).

Copyright Microsoft Corporation 1993.