Udostępnij za pośrednictwem


NamedRange.Name Property (2007 System)

Gets or sets a Name object for the NamedRange control.

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public Property Name As Object
'Usage
Dim instance As NamedRange 
Dim value As Object 

value = instance.Name

instance.Name = value
[BrowsableAttribute(false)]
public Object Name { get; set; }
[BrowsableAttribute(false)]
public:
property Object^ Name {
    Object^ get ();
    void set (Object^ value);
}
public function get Name () : Object 
public function set Name (value : Object)

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", missing], "Sales");

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

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace