NAME: Defined Name (218h)

The NAME record describes a defined name in the workbook.

Record Data

Offset

Name

Size

Contents

4

grbit

2

Option flags

6

chKey

1

Keyboard shortcut

7

cch

1

Length of the name text

8

cce

2

Length of the name definition

10

ixals

2

Index to the sheet that contains this name, if the name is a local name (see text)

12

itab

2

This field is equal to ixals

14

cchCustMenu

1

Length of the custom menu text

15

cchDescription

1

Length of the description text

16

cchHelptopic

1

Length of the help topic text

17

cchStatustext

1

Length of the status bar text

18

rgch

var

Name text

var

rgce

var

Name definition (see text)

var

rgchCustMenu

var

Custom menu text

var

rgchDescr

var

Description text

var

rgchHelptopic

var

Help topic text

var

rgchStatustext

var

Status bar text


The grbit field contains the option flags listed in the following table.

Bits

Mask

Name

Contents

0

0001h

fHidden

= 1 if the name is hidden

1

0002h

fFunc

= 1 if the name is a function

2

0004h

fOB

= 1 if the name is a Visual Basic procedure

3

0008h

fProc

= 1 if the name is a function or command name on a macro sheet

4

0010h

fCalcExp

= 1 if the name contains a complex function

5

0020h

fBuiltin

= 1 if the name is a built-in name

11–6

0FC0h

fgrp

Function group index

12

1000h

fBig

= 1 if the name refers to binary data (see text)

15–13

C000h

(Reserved)


If the fBig bit in the grbit field is equal to 1, the NAME record contains a name attached to binary data. These names can be created only by calling the xlDefineBinaryName function from the Microsoft Excel C API. The first byte is the length of the name, which is followed by the name string. Following the name string is the data to which the name refers. The data can be up to 232 bytes long and can span multiple CONTINUE records.

The fCalcExp bit is set if the name definition contains a function that returns an array (for example, TREND, MINVERSE), contains a ROW or COLUMN function, or contains a user-defined function.

The chKey byte is significant only when the fProc bit is set in the grbit field. chKey is the keyboard shortcut for a command macro name. If the name is not a command macro name or has no keyboard shortcut, chKey is meaningless.

The cch field contains the length of the name text, and the rgch field contains the text itself. The cce field contains the length of the name definition, and the rgce field contains the definition itself. The location of rgce within the record depends on the length of the name text (rgch) field.

The name definition (rgce) is stored in the Microsoft Excel parsed format. For more information, see "Microsoft Excel Formulas" on page 444.

The NAME record stores two types of names: global names and local names. A global name is defined for an entire workbook, and a local name is defined on a single sheet. For example, MyName is a global name, whereas Sheet1!MyName is a local name. The ixals field in the NAME record will be nonzero for local names and will index the list of EXTERNSHEET records for the sheets in the workbook. The following field, itab, is equal to ixals.

All NAME records should appear together in a BIFF file. The order of NAME records in an existing BIFF file should not be changed. You can add new names to a file, but you should add them at the end of the NAME list (block of NAME records). Microsoft Excel saves the names to the BIFF file in alphabetic order, but this is not a requirement; Microsoft Excel will sort the name list, if necessary, when it loads a BIFF file.

Built-in Names

Microsoft Excel contains several built-in names — such as Criteria, Database, Auto_Open, and so on — for which the NAME records do not contain the actual name. Instead, cch always equals 1, and a single byte is used to identify the name as shown in the following table.

Built-in name

rgch

Consolidate_Area

00

Auto_Open

01

Auto_Close

02

Extract

03

Database

04

Criteria

05

Print_Area

06

Print_Titles

07

Recorder

08

Data_Form

09

Auto_Activate

0A

Auto_Deactivate

0B

Sheet_Title

0C