NativeExcel2 for .Net Developer's Reference

IWorkbook.SaveAsMethod(String)

Saves changes to the workbook in a different file.

[Visual Basic]
FunctionSaveAs(_
ByValFilenameAsString_
)AsBoolean
[C#]
boolSaveAs(
stringFilename
);
[C++]
boolSaveAs(
String*Filename
);
[JScript]
functionSaveAs(
StringFilename
):bool;

Parameters

Filename
A string that indicates the name of the file to be saved. You can include a full path; if you don't, workbook saves the file in the current folder.

Return Value

Returns true if it succeeded, false otherwise.

Example

This example changes the name of the first sheet in book.xls.

[C#]
IWorkbook book = Factory.OpenWorkbook("book.xls");
if (book != null) {
    book.Worksheets[1].Name = "NewSheetName";
    book.SaveAs("book.xls");
} 
[VisualBasic]
Dim book As IWorkbook
book = Factory.OpenWorkbook("book.xls")
If Not book Is Nothing Then
    book.Worksheets(1).Name = "NewSheetName"
    book.SaveAs("book.xls")
End If 
[C++]
IWorkbook* book = Factory::OpenWorkbook(S"book.xls");
if (book != null) {
    book->Worksheets->Item[1]->Name = S"NewSheetName";
    book->SaveAs(S"book.xls");
} 

See Also

IWorkbook Interface | NativeExcel Namespace | IWorkbook.SaveAs Overload List | Factory Class