Propriedade XmlMappedRange.Name

Obtém ou define um valor que representa um nome definido para um XmlMappedRange de controle.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (em Microsoft.Office.Tools.Excel.dll)

Sintaxe

'Declaração
Property Name As Object
    Get
    Set
Object Name { get; set; }

Valor de propriedade

Tipo: System.Object
A Microsoft.Office.Interop.Excel.Name o objeto que representa um nome definido para um XmlMappedRange de controle.

Exemplos

O exemplo de código a seguir adiciona um Microsoft.Office.Interop.Excel.Name que se refere à célula ocupada por uma XmlMappedRange para a planilha atual. O exemplo usa o Name propriedade para exibir o nome que agora se refere ao XmlMappedRange. Este exemplo de código pressupõe que a planilha atual contém um XmlMappedRange chamado 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);
}

Segurança do .NET Framework

Consulte também

Referência

XmlMappedRange Interface

Namespace Microsoft.Office.Tools.Excel