Workbook.SaveAs Method

Saves changes to the workbook in a different file.

Namespace:  Microsoft.Office.Tools.Excel
Assemblies:   Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Sub SaveAs ( _
    Filename As Object, _
    FileFormat As Object, _
    Password As Object, _
    WriteResPassword As Object, _
    ReadOnlyRecommended As Object, _
    CreateBackup As Object, _
    AccessMode As XlSaveAsAccessMode, _
    ConflictResolution As Object, _
    AddToMru As Object, _
    TextCodepage As Object, _
    TextVisualLayout As Object, _
    Local As Object _
)
void SaveAs(
    Object Filename,
    Object FileFormat,
    Object Password,
    Object WriteResPassword,
    Object ReadOnlyRecommended,
    Object CreateBackup,
    XlSaveAsAccessMode AccessMode,
    Object ConflictResolution,
    Object AddToMru,
    Object TextCodepage,
    Object TextVisualLayout,
    Object Local
)

Parameters

  • Filename
    Type: System.Object

    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.

  • FileFormat
    Type: System.Object

    One of the XlFileFormat values that specifies the file format to use when you save the file. 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.

  • Password
    Type: System.Object

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

  • WriteResPassword
    Type: System.Object

    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.

  • ReadOnlyRecommended
    Type: System.Object

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

  • AddToMru
    Type: System.Object

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

  • TextCodepage
    Type: System.Object

    Ignored for all languages in Microsoft Excel.

    Note   When Excel saves a workbook to one of the CSV or text formats, which are specified by using the FileFormat parameter, it uses the code page that corresponds to the language for the system locale in use on the current computer.

  • TextVisualLayout
    Type: System.Object

    Ignored for all languages in Microsoft Excel.

    Note   When Excel saves a workbook to one of the CSV or text formats, which are specified by using the FileFormat parameter, it saves these formats in logical layout. If left-to-right text is embedded within right-to-left text in the file, or vice versa, logical layout saves the contents of the file in the correct reading order for all languages in the file without regard to direction. When an application is used to open the file, the characters in each run of characters are rendered in the correct direction according to the character value ranges within the code page. (Unless the file is opened in an application, such as a debugger or editor, that is designed to display the exact memory layout of the file.)

  • Local
    Type: System.Object

    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).

Remarks

Visual Studio does not support saving a workbook as a shared workbook.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

.NET Framework Security

See Also

Reference

Workbook Interface

Microsoft.Office.Tools.Excel Namespace