共用方式為


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)

Syntax

'Declaration
Property Name As Object
Object Name { get; set; }

Property Value

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

Examples

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

This example is for a document-level customization.

Private Sub DisplayName()
        Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
            = Me.Controls.AddNamedRange(Me.Range("B2"), "Sales")

        Dim name1 As Excel.Name = CType(namedRange1.Name, Excel.Name)
        MessageBox.Show(name1.Name)
    End Sub
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);
}

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace