Compartir a través de


WorksheetBase.Next (Propiedad)

Obtiene un objeto Microsoft.Office.Interop.Excel.Worksheet que representa la hoja siguiente.

Espacio de nombres:  Microsoft.Office.Tools.Excel
Ensamblado:  Microsoft.Office.Tools.Excel.v4.0.Utilities (en Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Sintaxis

'Declaración
Public ReadOnly Property Next As Object
public Object Next { get; }

Valor de propiedad

Tipo: System.Object
Objeto Microsoft.Office.Interop.Excel.Worksheet que representa la hoja siguiente; nullreferencia null (Nothing en Visual Basic) si la hoja de cálculo actual es la última hoja del libro.

Ejemplos

El ejemplo de código siguiente utiliza la propiedad Next para determinar si el objeto WorksheetBase actual es la última hoja del libro.Si el objeto WorksheetBase actual no es la última hoja, se muestra el nombre de la hoja siguiente.

Se trata de un ejemplo para una personalización en el nivel del documento.

Private Sub DisplayNextWorksheet()
    If Not (Me.Next Is Nothing) Then
        Dim nextSheet As Excel.Worksheet = _
            CType(Me.Next, Excel.Worksheet)
        MsgBox("The next worksheet is " & nextSheet.Name)
    Else
        MsgBox("This worksheet is the last worksheet.")
    End If
End Sub
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.");
    }
}

Seguridad de .NET Framework

Vea también

Referencia

WorksheetBase Clase

Microsoft.Office.Tools.Excel (Espacio de nombres)