Partager via


_Worksheet.SaveAs Method

Saves changes to the chart or worksheet in a different file.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Sub SaveAs ( _
    Filename As String, _
    FileFormat As Object, _
    Password As Object, _
    WriteResPassword As Object, _
    ReadOnlyRecommended As Object, _
    CreateBackup As Object, _
    AddToMru As Object, _
    TextCodepage As Object, _
    TextVisualLayout As Object, _
    Local As Object _
)
'Usage
Dim instance As _Worksheet
Dim Filename As String
Dim FileFormat As Object
Dim Password As Object
Dim WriteResPassword As Object
Dim ReadOnlyRecommended As Object
Dim CreateBackup As Object
Dim AddToMru As Object
Dim TextCodepage As Object
Dim TextVisualLayout As Object
Dim Local As Object

instance.SaveAs(Filename, FileFormat, _
    Password, WriteResPassword, ReadOnlyRecommended, _
    CreateBackup, AddToMru, TextCodepage, _
    TextVisualLayout, Local)
void SaveAs(
    string Filename,
    Object FileFormat,
    Object Password,
    Object WriteResPassword,
    Object ReadOnlyRecommended,
    Object CreateBackup,
    Object AddToMru,
    Object TextCodepage,
    Object TextVisualLayout,
    Object Local
)

Parameters

  • Filename
    Type: System.String

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

  • FileFormat
    Type: System.Object

    Optional Object. 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.

  • Password
    Type: System.Object

    Optional 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

    Optional Object. A string that indicates the write-reservation password for this file. If a file is saved with the password and the password isn't supplied when the file is opened, the file is opened as read-only.

  • ReadOnlyRecommended
    Type: System.Object

    Optional Object. True to display a message when the file is opened recommending that the file be opened as read-only.

  • CreateBackup
    Type: System.Object

    Optional Object. True to create a backup file.

  • AddToMru
    Type: System.Object

    Optional Object. True to add this workbook to the list of recently used files. The default value is False.

  • TextCodepage
    Type: System.Object

    Optional Object. Not used in U.S. English Microsoft Excel.

  • TextVisualLayout
    Type: System.Object

    Optional Object. Not used in U.S. English Microsoft Excel.

  • Local
    Type: System.Object

    Optional Object. True saves files against the language of Microsoft Excel (including control panel settings). False (default) saves files against the language of Visual Basic for Applications (VBA) (which is typically U.S. English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project).

See Also

Reference

_Worksheet Interface

_Worksheet Members

Microsoft.Office.Interop.Excel Namespace