Condividi tramite


Proprietà XmlMappedRange.Name

Ottiene o imposta un valore che rappresenta un nome definito per un controllo XmlMappedRange.

Spazio dei nomi:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Sintassi

'Dichiarazione
Property Name As Object
    Get
    Set
Object Name { get; set; }

Valore proprietà

Tipo: System.Object
Oggetto Microsoft.Office.Interop.Excel.Name che rappresenta un nome definito per un controllo XmlMappedRange.

Esempi

Nell'esempio di codice riportato di seguito al foglio di lavoro corrente viene aggiunto un oggetto Microsoft.Office.Interop.Excel.Name che fa riferimento alla cella occupata da un controllo XmlMappedRange Viene quindi utilizzata la proprietà Name per visualizzare il nome attualmente riferito al controllo XmlMappedRange. Nell'esempio si presuppone che il foglio di lavoro corrente contenga un controllo XmlMappedRange denominato 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);
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

XmlMappedRange Interfaccia

Spazio dei nomi Microsoft.Office.Tools.Excel