NativeExcel for .Net Developer's Reference

IWorksheet.Index Property

Returns the index number of the worksheet within the IWorksheets collection. Read-only.

[Visual Basic]
Property ReadOnly Index As Integer
[C#]
int Index { get; }
[C++]
__property int get_Index();
[JScript]
function get Index() : int

Example

This example returns the index number of the worksheet with the specified name.

[C#]
public int NameToIndex(IWorkbook book, string Name) {
    return book.Worksheets[Name].Index;
}
[Visual Basic]
Public Function NameToIndex(Book As IWorkbook, Name As String) As Integer
   Return Book.Worksheets(Name).Index
End Function
[C++]
public int NameToIndex(IWorkbook* book, String* Name) {
    return book->Worksheets->Item[Name]->Index;
}

See Also

IWorksheet Interface | NativeExcel Namespace | IWorksheets Interface