Names.Add Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines a new name. Returns a Name object.
public Microsoft.Office.Interop.Excel.Name Add (object Name, object RefersTo, object Visible, object MacroType, object ShortcutKey, object Category, object NameLocal, object RefersToLocal, object CategoryLocal, object RefersToR1C1, object RefersToR1C1Local);
Parameters
- Name
- Object
Optional Object. Required if NameLocal
isn't specified. The text to use as the name. Names cannot include spaces and cannot look like cell references.
- RefersTo
- Object
Optional Object. Required unless one of the other RefersTo
arguments is specified. Describes what the name refers to (using A1-style notation). Note Nothing is returned if the reference does not exist.
- Visible
- Object
Optional Object. 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.
- MacroType
- Object
Optional Object. The macro type, as shown in the following table.ValueMeaning1User-defined function (Function procedure)2Macro (also known as Sub procedure)3 or omittedNone (that is, the name doesn't refer to a user-defined function or macro)
- ShortcutKey
- Object
Optional Object. The macro shortcut key. Must be a single letter, such as "z" or "Z". Applies only for command macros.
- Category
- Object
Optional Object. The category of the macro or function if MacroType
is 1 or 2. The category is used in the Function Wizard. Existing categories can be referred to either by number (starting at 1) or by name (in the language of the macro). Microsoft Excel creates a new category if the specified category doesn't already exist.
- NameLocal
- Object
Optional Object. Required if Name
isn't specified. The text to use as the name (in the language of the user). Names cannot include spaces and cannot look like cell references.
- RefersToLocal
- Object
Optional Object. Required unless one of the other RefersTo
arguments is specified. Describes what the name refers to (in the language of the user, using A1-style notation).
- CategoryLocal
- Object
Optional Object. Required if Category
isn't specified. Text identifying the category of a custom function in the language of the user.
- RefersToR1C1
- Object
Optional Object. Required unless one of the other RefersTo
arguments is specified. Describes what the name refers to (using R1C1-style notation).
- RefersToR1C1Local
- Object
Optional Object. Required unless one of the other RefersTo
arguments is specified. Describes what the name refers to (in the language of the user, using R1C1-style notation).