This documentation is archived and is not being maintained.

Workbook.SaveAs Method

Saves changes to the workbook in a different file.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in

public virtual void SaveAs (
	[OptionalAttribute] Object Filename,
	[OptionalAttribute] Object FileFormat,
	[OptionalAttribute] Object Password,
	[OptionalAttribute] Object WriteResPassword,
	[OptionalAttribute] Object ReadOnlyRecommended,
	[OptionalAttribute] Object CreateBackup,
	[OptionalAttribute] XlSaveAsAccessMode AccessMode,
	[OptionalAttribute] Object ConflictResolution,
	[OptionalAttribute] Object AddToMru,
	[OptionalAttribute] Object TextCodepage,
	[OptionalAttribute] Object TextVisualLayout,
	[OptionalAttribute] Object Local



The name of the file to be saved. You can include a full path; if you do not, Microsoft Office Excel saves the file in the current folder.


The file format to use when you save the file. For a list of valid choices, see the FileFormat property. For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used.


A case-sensitive string (no more than 15 characters) that indicates the protection password to be given to the file.


The write-reservation password for this file. If a file is saved with the password and the password is not supplied when the file is opened, the file is opened as read-only.


true to display a message when the file is opened, recommending that the file be opened as read-only.


true to create a backup file.


One of the XlSaveAsAccessMode values.


One of the XlSaveConflictResolution values.


true to add this workbook to the list of recently used files. The default value is false.


Not used in U.S. English Excel.


Not used in U.S. English Excel.


true saves files against the language of Excel (including control panel settings). false (default) saves files against the language of Visual Basic for Applications (VBA).

Microsoft Visual Studio 2005 Tools for the Microsoft Office System does not support saving a workbook as a shared workbook.

Optional Parameters

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

The following code example checks the value of the FileFormat property to determine whether the workbook is a normal workbook. If the workbook is a normal workbook, then the example calls the SaveAs method to resave the workbook as an XML spreadsheet with the name XMLCopy.xls in the path specified by the Path property.

private void WorkbookSaveAs()
    if (this.FileFormat == Excel.XlFileFormat.xlWorkbookNormal)
        this.SaveAs(this.Path + @"\XMLCopy.xls",
            Excel.XlFileFormat.xlXMLSpreadsheet, missing, missing,
            false, false, Excel.XlSaveAsAccessMode.xlNoChange,
            missing, missing, missing, missing, missing);