ChartSheet.Next 屬性
取得 Microsoft.Office.Interop.Excel.Worksheet 物件,表示下一個工作表。
命名空間: Microsoft.Office.Tools.Excel
組件: Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)
語法
'宣告
ReadOnly Property Next As Object
Get
Object Next { get; }
屬性值
型別:System.Object
Microsoft.Office.Interop.Excel.Worksheet 物件,表示下一個工作表。
範例
下列程式碼範例會使用 Next 和 Previous 屬性,顯示目前 Microsoft.Office.Tools.Excel.ChartSheet 下一個工作表和上一個工作表的名稱。
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.");
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。