NativeExcel2 for .Net Developer's Reference

IWorksheets.AddBeforeMethod(Object, Int32)

Creates new worksheets. You can insert the new worksheets before an existing worksheet.

[Visual Basic]
FunctionAddBefore(_
ByValBeforeAsObject,_
ByValCountAsInteger_
)AsIWorksheet
[C#]
IWorksheetAddBefore(
objectBefore,
intCount
);
[C++]
IWorksheet*AddBefore(
Object*Before,
intCount
);
[JScript]
functionAddBefore(
ObjectBefore,
intCount
):IWorksheet;

Parameters

Before
An object that specifies the worksheet before which the new worksheet is added. Can be either an IWorksheet interface, Number which indicates the worksheet index or String which indicates the worksheet name.
Count
The number of worksheets to be added.

Return Value

IWorksheet interface.

Example

This example creates two new worksheets before sheet with name "Sheet3".

[C#]
book.Worksheets.AddBefore("Sheet3", 2);
[VisualBasic]
book.Worksheets.AddBefore("Sheet3", 2)
[C++]
book->Worksheets->AddBefore(S"Sheet3", 2);
This example creates a new worksheet before first worksheet.
[C#]
book.Worksheets.AddBefore(1, 1);
[VisualBasic]
book.Worksheets.AddBefore(1, 1)
[C++]
book->Worksheets->AddBefore(1, 1);

See Also

IWorksheets Interface | NativeExcel Namespace | IWorksheets.AddBefore Overload List