Udostępnij za pośrednictwem


NamedRange.Worksheet Property (2007 System)

Gets a Worksheet that represents the worksheet that contains the NamedRange 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 ReadOnly Property Worksheet As Worksheet
'Usage
Dim instance As NamedRange 
Dim value As Worksheet 

value = instance.Worksheet
[BrowsableAttribute(false)]
public Worksheet Worksheet { get; }
[BrowsableAttribute(false)]
public:
property Worksheet^ Worksheet {
    Worksheet^ get ();
}
public function get Worksheet () : Worksheet

Property Value

Type: Worksheet
A Worksheet that represents the worksheet that contains the NamedRange control.

Examples

The following code example displays the name of the worksheet that contains a NamedRange.

This example is for a document-level customization.

Private Sub DisplayWorksheetName()
    Dim namedRange1 As Microsoft.Office.Tools.Excel.NamedRange _
        = Me.Controls.AddNamedRange(Me.Range("A1"), _
        "namedRange1")
    namedRange1.Worksheet.Name = "Sales"
    MessageBox.Show("The NamedRange is on worksheet " & _
        namedRange1.Worksheet.Name)
End Sub
private void DisplayWorksheetName()
{
    Microsoft.Office.Tools.Excel.NamedRange namedRange1 =
        this.Controls.AddNamedRange(this.Range["A1", missing],
        "namedRange1");
    namedRange1.Worksheet.Name = "Sales";
    MessageBox.Show("The NamedRange is on worksheet " +
        namedRange1.Worksheet.Name);
}

.NET Framework Security

See Also

Reference

NamedRange Class

NamedRange Members

Microsoft.Office.Tools.Excel Namespace