Compartilhar via


Propriedade ChartSheetBase.Next

Obtém um objeto de Microsoft.Office.Interop.Excel.Worksheet que representa a folha seguir.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (em Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Sintaxe

'Declaração
Public ReadOnly Property Next As Object
public Object Next { get; }

Valor de propriedade

Tipo: System.Object
Um objeto de Microsoft.Office.Interop.Excel.Worksheet que representa a folha seguir.

Exemplos

O exemplo de código usa as propriedades de Next e de Previous para exibir os nomes das folhas próximo e anterior para Microsoft.Office.Tools.Excel.ChartSheetBaseatual.

Private Sub DisplayNextAndPrevious()
    Globals.Sheet1.Range("A1", "A5").Value2 = 22
    Globals.Sheet1.Range("B1", "B5").Value2 = 55

    Me.SetSourceData(Globals.Sheet1.Range("A1", "B5"), _
        Excel.XlRowCol.xlColumns)
    Me.ChartType = Excel.XlChartType.xl3DColumn

    Dim nextSheet As Excel.Worksheet = _
        CType(Me.Next, Excel.Worksheet)
    Dim previousSheet As Excel.Worksheet = _
        CType(Me.Previous, Excel.Worksheet)

    If Not (nextSheet Is Nothing) Then
        MsgBox("The next sheet is: " & nextSheet.Name)
    Else
        MsgBox("This sheet is the last sheet.")
    End If

    If Not (previousSheet Is Nothing) Then
        MsgBox("The previous sheet is: " & _
            previousSheet.Name)
    Else
        MsgBox("This sheet is the first sheet.")
    End If
End Sub
private void DisplayNextAndPrevious()
{
    Globals.Sheet1.Range["A1", "A5"].Value2 = 22;
    Globals.Sheet1.Range["B1", "B5"].Value2 = 55;

    this.SetSourceData(Globals.Sheet1.Range["A1", "B5"],
        Excel.XlRowCol.xlColumns);
    this.ChartType = Excel.XlChartType.xl3DColumn;

    Excel.Worksheet nextSheet = (Excel.Worksheet)this.Next;
    Excel.Worksheet previousSheet = 
        (Excel.Worksheet)this.Previous;

    if (nextSheet != null)
    {
        MessageBox.Show("The next sheet is: " + 
            nextSheet.Name);
    }
    else
    {
        MessageBox.Show("This sheet is the last sheet.");
    }

    if (previousSheet != null)
    {
        MessageBox.Show("The previous sheet is: " + 
            previousSheet.Name);
    }
    else
    {
        MessageBox.Show("This sheet is the first sheet.");
    }
}

Segurança do .NET Framework

Consulte também

Referência

ChartSheetBase Classe

Namespace Microsoft.Office.Tools.Excel