Export (0) Print
Expand All
Expand Minimize

Worksheet.Next Property (2007 System)

Gets a Worksheet that represents the next sheet.

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

[BrowsableAttribute(false)]
public Object Next { get; }

Property Value

Type: System.Object
A Worksheet that represents the next sheet; null if the current worksheet is the last sheet in the workbook.

The following code example uses the Next property to determine whether the current Worksheet is the last sheet in the workbook. If the current Worksheet is not the last sheet, then the name of the next sheet is displayed.

This example is for a document-level customization.

private void DisplayNextWorksheet()
{
    if (this.Next != null)
    {
        Excel.Worksheet nextSheet = (Excel.Worksheet)this.Next;
        MessageBox.Show("The next worksheet is " + nextSheet.Name);
    }
    else
    {
        MessageBox.Show("This worksheet is the last worksheet.");
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft