Export (0) Print
Expand All
Expand Minimize

NamedRange.Name Property

Gets or sets a Name object for the NamedRange control.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Object Name { get; set; }

Property Value

Type: System.Object
A Name object for the NamedRange control.

The following code example creates a NamedRange and then displays the name in a message.

This example is for a document-level customization.

private void DisplayName()
{
    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(
        this.Range["B2"], "Sales");

    Excel.Name name1 = ((Excel.Name)namedRange1.Name);
    MessageBox.Show(name1.Name);
}

Show:
© 2014 Microsoft