WorksheetBase.Previous-Eigenschaft
Ruft ein Microsoft.Office.Interop.Excel.Worksheet ab, das das vorherige Blatt darstellt.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
Public ReadOnly Property Previous As Object
public Object Previous { get; }
Eigenschaftswert
Typ: System.Object
Ein Microsoft.Office.Interop.Excel.Worksheet, das das vorherige Blatt darstellt; nullein Nullverweis (Nothing in Visual Basic), wenn das aktuelle Arbeitsblatt das erste Blatt in der Arbeitsmappe ist.
Beispiele
Im folgenden Codebeispiel wird die Previous-Eigenschaft verwendet, um festzustellen, ob das aktuelle WorksheetBase das erste Blatt in der Arbeitsmappe ist.Wenn das aktuelle WorksheetBase nicht das erste Blatt ist, wird der Name des vorherigen Blatts angezeigt.
Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.
Private Sub DisplayPrevious()
If Not (Me.Previous Is Nothing) Then
Dim sheet As Excel.Worksheet = _
CType(Me.Previous, Excel.Worksheet)
MsgBox("The previous worksheet is " & sheet.Name)
Else
MsgBox("The current worksheet is the first worksheet.")
End If
End Sub
private void DisplayPrevious()
{
if (this.Previous != null)
{
Excel.Worksheet sheet = (Excel.Worksheet)this.Previous;
MessageBox.Show("The previous worksheet is " + sheet.Name);
}
else
{
MessageBox.Show("The current worksheet is the first worksheet.");
}
}
.NET Framework-Sicherheit
- Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter Verwenden von Bibliotheken aus teilweise vertrauenswürdigem Code.