Names.Add Method
Defines a new name. Returns a Name object.
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Function Add ( _
Name As Object, _
RefersTo As Object, _
Visible As Object, _
MacroType As Object, _
ShortcutKey As Object, _
Category As Object, _
NameLocal As Object, _
RefersToLocal As Object, _
CategoryLocal As Object, _
RefersToR1C1 As Object, _
RefersToR1C1Local As Object _
) As Name
'Usage
Dim instance As Names
Dim Name As Object
Dim RefersTo As Object
Dim Visible As Object
Dim MacroType As Object
Dim ShortcutKey As Object
Dim Category As Object
Dim NameLocal As Object
Dim RefersToLocal As Object
Dim CategoryLocal As Object
Dim RefersToR1C1 As Object
Dim RefersToR1C1Local As Object
Dim returnValue As Name
returnValue = instance.Add(Name, RefersTo, _
Visible, MacroType, ShortcutKey, _
Category, NameLocal, RefersToLocal, _
CategoryLocal, RefersToR1C1, RefersToR1C1Local)
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
Type: System.ObjectOptional 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
Type: System.ObjectOptional 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
Type: System.ObjectOptional 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
Type: System.ObjectOptional Object. The macro type, as shown in the following table.
Value
Meaning
1
User-defined function (Function procedure)
2
Macro (also known as Sub procedure)
3 or omitted
None (that is, the name doesn't refer to a user-defined function or macro)
ShortcutKey
Type: System.ObjectOptional Object. The macro shortcut key. Must be a single letter, such as "z" or "Z". Applies only for command macros.
Category
Type: System.ObjectOptional 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
Type: System.ObjectOptional 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
Type: System.ObjectOptional 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
Type: System.ObjectOptional Object. Required if Category isn't specified. Text identifying the category of a custom function in the language of the user.
RefersToR1C1
Type: System.ObjectOptional Object. Required unless one of the other RefersTo arguments is specified. Describes what the name refers to (using R1C1-style notation).
RefersToR1C1Local
Type: System.ObjectOptional 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).
Return Value
Type: Microsoft.Office.Interop.Excel.Name