Workbook.SaveAs Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Saves changes to the workbook in a different file.
public void SaveAs (object Filename, object FileFormat, object Password, object WriteResPassword, object ReadOnlyRecommended, object CreateBackup, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode AccessMode = Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, object ConflictResolution, object AddToMru, object TextCodepage, object TextVisualLayout, object Local);
abstract member SaveAs : obj * obj * obj * obj * obj * obj * Microsoft.Office.Interop.Excel.XlSaveAsAccessMode * obj * obj * obj * obj * obj -> unit
Public Sub SaveAs (Optional Filename As Object, Optional FileFormat As Object, Optional Password As Object, Optional WriteResPassword As Object, Optional ReadOnlyRecommended As Object, Optional CreateBackup As Object, Optional AccessMode As XlSaveAsAccessMode = Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Optional ConflictResolution As Object, Optional AddToMru As Object, Optional TextCodepage As Object, Optional TextVisualLayout As Object, Optional Local As Object)
Parameters
- Filename
- 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
- 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
- Object
A case-sensitive string (no more than 15 characters) that indicates the protection password to be given to the file.
- WriteResPassword
- 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
- Object
true
to display a message when the file is opened, recommending that the file be opened as read-only.
- CreateBackup
- Object
true
to create a backup file.
- AccessMode
- XlSaveAsAccessMode
One of the XlSaveAsAccessMode values.
- ConflictResolution
- Object
One of the XlSaveConflictResolution values.
- AddToMru
- Object
true
to add this workbook to the list of recently used files. The default value is false
.
- TextCodepage
- 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
- 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
- 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.