WorksheetBase.Index-Eigenschaft

Ruft die Indexnummer des Arbeitsblatts innerhalb der Auflistung der Arbeitsblätter ab.

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 Index As Integer
public int Index { get; }

Eigenschaftswert

Typ: System.Int32
Die Indexnummer des Arbeitsblatts innerhalb der Auflistung der Arbeitsblätter.

Beispiele

Im folgenden Codebeispiel wird die Index-Eigenschaft verwendet, um die Indexnummer des aktuellen Arbeitsblatts vor und nach der Verschiebung des Arbeitsblatts an die letzte Position in der Arbeitsmappe mithilfe der Move-Methode anzuzeigen.

Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.

Private Sub DisplayIndex()
    MsgBox("Before moving, this worksheet is at tab number " & _
        Me.Index.ToString())

    ' Move the worksheet to the last position in the workbook.
    Me.Move(After:=Globals.ThisWorkbook.Worksheets( _
        Globals.ThisWorkbook.Worksheets.Count))

    MsgBox("After moving, this worksheet is at tab number " & _
        Me.Index.ToString())
End Sub
private void DisplayIndex()
{
    MessageBox.Show("Before moving, this worksheet is at tab number " +
        this.Index.ToString());

    // Move the worksheet to the last position in the workbook.
    this.Move(missing, 
        Globals.ThisWorkbook.Worksheets[Globals.ThisWorkbook.Worksheets.Count]);

    MessageBox.Show("After moving, this worksheet is at tab number " +
        this.Index.ToString());
}

.NET Framework-Sicherheit

Siehe auch

Referenz

WorksheetBase Klasse

Microsoft.Office.Tools.Excel-Namespace