Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

A NamedObject object may refer to an array, number, picture, or range. To create a NamedObject in an Excel file, use the corresponding method for the specific object you wish to create (Pictures.CreatePicture(), Workbook.CreateRange(), etc). To get a NamedObject from an existing file, use Workbook.GetNamedObject(), passing in the name of the object you wish to get.

Signature
C#
C#
 public sealed class NamedObject
{signature}{signature:
}
Signature
vb.net
vb.net
Public NotInheritable Class NamedObject
{signature}

{example}
The following sample gets a {{NamedObject}} from a [Workbook|Workbook].
{code:csharp|title=C#}
Example

The following sample gets a NamedObject from a Workbook.

Code Block
csharp
csharp
titleC#

          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Open(@"C:\MySpreadsheet.xls");
          NamedObject namedObj = wb.GetNamedObject("MyNamedObject");
{code} {code:vbnet|title=
Code Block
vbnet
vbnet
titlevb.net
}

          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Open("C:\MySpreadsheet.xls")
          Dim namedObj As NamedObject = wb.GetNamedObject("MyNamedObject")
{code} {example} {properties} ||Name||Description|| |[Formula|NamedObject.Formula]|{excerpt-include:NamedObject.Formula|nopanel=true}| |[Name|NamedObject.Name]|{excerpt-include:NamedObject.Name|nopanel=true}| |[NamedObjectType|NamedObject.NamedObjectType]|{excerpt-include:NamedObject.NamedObjectType|nopanel=true}| |[NameScope|NamedObject.NameScope]|{excerpt-include:NamedObject.NameScope|nopanel=true}| |[Value|NamedObject.Value]|{excerpt-include:NamedObject.Value|nopanel=true}| {classes} ||Name||Description|| |[BuiltInName|NamedObject.BuiltInName]|{excerpt-include:NamedObject.BuiltInName|nopanel=true}| |[ReturnType|NamedObject.ReturnType]|{excerpt-include:NamedObject.ReturnType|nopanel=true}| |[Scope|NamedObject.Scope]|{excerpt-include:NamedObject.Scope|nopanel=true}| {remarks} Named objects with type {{ReturnType.Range}} can also be accessed (as {{Range}} objects) through the {{Workbook.GetNamedRange}} and {{Worksheet.GetNamedRange}} methods. These objects will change their value like other ranges in response to adding or deleting rows, and other similar actions. Named objects with type {{ReturnType.Formula}} and {{ReturnType.ExternalReference}}, though they may contain formulas with cell references, will not respond to such actions. {remarks}
Properties

Name

Description

Formula

Excerpt Include
NamedObject.Formula
NamedObject.Formula
nopaneltrue

Name

Excerpt Include
NamedObject.Name
NamedObject.Name
nopaneltrue

NamedObjectType

Excerpt Include
NamedObject.NamedObjectType
NamedObject.NamedObjectType
nopaneltrue

NameScope

Excerpt Include
NamedObject.NameScope
NamedObject.NameScope
nopaneltrue

Value

Excerpt Include
NamedObject.Value
NamedObject.Value
nopaneltrue
Classes

Name

Description

BuiltInName

Excerpt Include
NamedObject.BuiltInName
NamedObject.BuiltInName
nopaneltrue

ReturnType

Excerpt Include
NamedObject.ReturnType
NamedObject.ReturnType
nopaneltrue

Scope

Excerpt Include
NamedObject.Scope
NamedObject.Scope
nopaneltrue
Remarks

Named objects with type ReturnType.Range can also be accessed (as Range objects) through the Workbook.GetNamedRange and Worksheet.GetNamedRange methods. These objects will change their value like other ranges in response to adding or deleting rows, and other similar actions.

Named objects with type ReturnType.Formula and ReturnType.ExternalReference, though they may contain formulas with cell references, will not respond to such actions.