Customizing Microsoft(R) Excel Initialization Files

Created: March 20, 1992

ABSTRACT

This article describes the preference variables stored in MicrosoftÒ Excel initialization files in the Microsoft WindowsÔ, OS/2Ò, and AppleÒ MacintoshÒ environments. It also explains how you can define menus and commands to customize your Microsoft Excel sessions.

INTRODUCTION

MicrosoftÒ Excel for WindowsÔ and Microsoft Excel for OS/2Ò store preference variables in an initialization file called EXCEL.INI. Microsoft Excel creates this file in the same directory as WIN.INI (for Microsoft Windows) or OS2.INI (for OS/2).

Before searching for specific preference variables, Microsoft Excel looks for the [Microsoft Excel] section of EXCEL.INI. If it doesn’t find this section, it looks for the [Microsoft Excel] section of WIN.INI or OS2.INI. If Microsoft Excel finds this section in WIN.INI or OS2.INI, it copies all variables and values from this section to the corresponding section in EXCEL.INI.

Microsoft Excel for the AppleÒ MacintoshÒ stores all preference variables in the Excel Settings file.

The following tables describe the Microsoft Excel preference variables stored in the EXCEL.INI and Excel Settings files. The Environment column identifies the operating system(s) (Windows, OS/2, Macintosh) in which each variable is found.

[Microsoft Excel] SECTION

Variable Environment Type Default

Options All Int 0x157
Options3 All Int 0x1
AutoDec All Int 4
MenuKey All Int  
Entermove All Int 1
KeyLocks Macintosh Int  
AltStartup All String (NULL)
Open All String (NULL)
Maximized Windows Int 1
Maximized OS/2 Int 0
Randomize Windows, OS/2 Int 0
Font Windows, OS/2 String  
GlDft-Punctuation Windows, OS/2 Int  
GlDft-IntlDate Windows, OS/2 Int  
GlDft-IntlTime Windows, OS/2 Int  
GlDft-CurrencyPrefix Windows, OS/2 Int  
GlDft-LeftMargin Windows, OS/2 String 0.75
GlDft-RightMargin Windows, OS/2 String 0.75
GlDft-TopMargin Windows, OS/2 String 1.0
GlDft-BottomMargin Windows, OS/2 String 1.0
GlDft-Directory Windows, OS/2 String  
GlDft-CurrencySymbol Windows, OS/2 String  
GlDft-DemoSpeed Windows, OS/2 Int  
GlDft-HelpType Windows, OS/2 Int  

The Options preference variable contains flag bits cast to a decimal integer. The default value is 343 (hexadecimal 157), or 0000 0001 0101 0111 binary.

Bit Default Flag

0 1 Show scroll bars
1 1 Show formula bar
2 1 Show status bar
3 0 (unused)
4 1 A1 (not R1C1)
5 0 Short menus
6 1 Dynamic data exchange (DDE) enabled
7-8 2 Menu undo (0, 1, 2, 3)
9 0 LotusÒ help
10 0 (unused)
11 0 (unused)
12 0 (unused)
13 0 (unused)
14 0 (unused)
15 0 (unused)

The Options3 preference variable contains flag bits cast to a decimal integer. The default value is 1 (hexadecimal 01), or 0000 0000 0000 0001 binary.

Bit Default Flag

0 1 Show tool bar
1 0 (unused)
2 0 Lotus help
3 0 Note indicator off
4 0 (unused)
5 0 (unused)
6 0 (unused)
7 0 (unused)
8 0 (unused)
9 0 (unused)
10 0 (unused)
11 0 (unused)
12 0 (unused)
13 0 (unused)
14 0 Display grid def
15 0 (unused)

[Recent File List] SECTION

Variable Environment Type Default

File1 All String (NULL)
File2 All String (NULL)
File3 All String (NULL)
File4 All String (NULL)

USER-DEFINED MENUS AND COMMANDS SECTION

In Microsoft Excel version 3.0, EXCEL.INI contains two new sections, [InitMenus] and [InitCommands], which let you define custom menus and commands. Custom menus and commands appear every time you start Microsoft Excel and allow you to load additional or standard macro sheets after you choose the Custom command.

The Excel Settings file in Microsoft Excel for the Macintosh has no section markers such as [InitCommands]. You can type the string directly into the file.

[Init Menus]

This section contains entries in the form:

keyword = bar, menu, position

where:

keyword A unique keyword.
bar The (built-in) bar number on which the menu is added.
menu The name of the new menu.
position The position of the new menu, specified as text or as a number. If this argument is omitted, the new menu appears at the end of the bar.

The following example shows how you can add a Debug menu to the full worksheet menu bar (bar=1), between the Window and Help menus (position=9).

[Init Menus]

DebugMenu=1,Debug,9

[Init Commands]

This section contains entries in the form:

keyword = bar, menu, command, macro, position, key, status, help

where:

keyword A unique keyword.
bar The (built-in) bar number on which the menu containing the command is added.
menu The menu that contains the new command.
command The name of the new command.
macro The macro attached to the command.
position The position of the command on the menu, specified as text or as a number. If this argument is omitted, the command appears as the last menu item.
key (Macintosh only) The shortcut key for the menu.
status The status bar string for the command.
help The help string to use for the command.

The following example shows how the Microsoft Excel Solver companion application can add two commands to the built-in bar number 1. The first command is called “Solver...” and appears as the last item on the Formula menu. The second command is called “Edit Stuff” and appears as the last item on the Edit menu.

[Init Commands]

Solver1=1,Formula,Solver...,'c:\windows\solver.xlm'!Auto_Open,,,

Solves stuff,Help!35

Solver2=1,Edit,Edit Stuff,'c:\windows\solver.xlm'!Edit,,,

"Edits stuff, eh?",Help!35

Microsoft Excel ignores any white space around the separating commas. You can include commas in a field by delimiting the field in quotation marks. To include quotation marks in a quoted field, you must double the quotation marks.