Defines a new name. Returns an
IXLSName Interface.
Syntax
function Add(Name: Widestring; RefersTo: Widestring):
IXLSName;
function Add(Name: Widestring; RefersTo: Widestring; Visible: boolean):
IXLSName;
| Name |
Required Widestring. The text to use as the name. Names cannot include spaces and cannot look like cell references. |
| RefersTo |
Required Widestring. Describes what the name refers to (using A1-style notation). |
| Visible |
Optional Boolean. True to define the name normally. False to define the name as a hidden name (that is, it doesn't appear in either the Define Name, Paste Name, or Goto dialog box). The default value is True. |
Example
This example adds new defined name for the Workbook and use this name in the cell Formula.
Workbook.Names.Add('MyName','=Sheet1!$F$10:$H$20');
Workbook.Sheets[1].Cells[3,4].Formula := '=SUM(MyName)';
This example adds new defined name for the Worksheet one and use this name in the cell Formula.