Partilhar via


NamedRange.Application Property

Gets a Microsoft.Office.Interop.Excel.Application that represents the creator of the NamedRange control.

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

Syntax

'Declaration
ReadOnly Property Application As Application
Application Application { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.Application
A Microsoft.Office.Interop.Excel.Application that represents the creator of the NamedRange control.

Examples

The following code example gets the name and version of the application that contains the NamedRange and displays the information in a message box.

This example is for a document-level customization.

Private Sub DisplayApplicationVersion()
    Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
        = Me.Controls.AddNamedRange(Me.Range("A2", "C4"), _
        "namedRange1")
    Dim applicationVersion As String = _
        namedRange1.Application.Name & " " & _
        namedRange1.Application.Version
    MessageBox.Show(applicationVersion)
End Sub
private void DisplayApplicationVersion()
{
    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A2", "C4"],
        "namedRange1");
    string applicationVersion = namedRange1.Application.Name +
        " " + namedRange1.Application.Version;
    MessageBox.Show(applicationVersion);
}

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace