Udostępnij za pośrednictwem


XmlMappedRange.Name Property (2007 System)

Gets or sets a value representing a defined name for an XmlMappedRange 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 XmlMappedRange 
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 that represents a defined name for an XmlMappedRange control.

Examples

The following code example adds a Name that refers to the cell occupied by an XmlMappedRange to the current worksheet. The example then uses the Name property to display the name that now refers to the XmlMappedRange. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

Private Sub DisplayName()
    ' Get the location of the XmlMappedRange and prefix it with a "=". 
    Dim location As String = Me.CustomerLastNameCell.Address( _
        True, True, Excel.XlReferenceStyle.xlA1, False)
    location = location.Insert(0, "=")

    ' Add a name at the location of the XmlMappedRange. 
    Me.Names.Add("LastName", location)

    ' Get the Name of the XmlMappedRange and display the name. 
    Dim name2 As Excel.Name = CType(Me.CustomerLastNameCell.Name, Excel.Name)
    MsgBox("The name of CustomerLastNameCell is: " & name2.Name)
End Sub
private void DisplayName()
{
    // Get the location of the XmlMappedRange and prefix it with a "=".
    string location = this.CustomerLastNameCell.Address[true, true,
        Excel.XlReferenceStyle.xlA1, false, missing];
    location = location.Insert(0, "=");

    // Add a name at the location of the XmlMappedRange. 
    this.Names.Add("LastName", location, missing, missing, missing, missing,
        missing, missing, missing, missing, missing);

    // Get the Name of the XmlMappedRange and display the name.
    Excel.Name name2 = ((Excel.Name)this.CustomerLastNameCell.Name);
    MessageBox.Show(name2.Name);
}

.NET Framework Security

See Also

Reference

XmlMappedRange Class

XmlMappedRange Members

Microsoft.Office.Tools.Excel Namespace