Condividi tramite


NamedRange.Name Property

Definition

Gets or sets a Name object for the NamedRange control.

public:
 property System::Object ^ Name { System::Object ^ get(); void set(System::Object ^ value); };
public object Name { get; set; }
member this.Name : obj with get, set
Public Property Name As Object

Property Value

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 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);
}
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

Applies to