다음을 통해 공유


NamedRange.Application Property

Definition

Gets a Application that represents the creator of the NamedRange control.

public:
 property Microsoft::Office::Interop::Excel::Application ^ Application { Microsoft::Office::Interop::Excel::Application ^ get(); };
public Microsoft.Office.Interop.Excel.Application Application { get; }
member this.Application : Microsoft.Office.Interop.Excel.Application
Public ReadOnly Property Application As Application

Property Value

A 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 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);
}
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

Applies to