SaveAs Method

This method saves changes to a workbook in the specified file. The syntax is:

expression.SaveAs(Filename, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution,

AddToMru, TextCodePage, TextVisualLayout)

The Filename parameter specifies the filename to use for the newly saved disk file. If a path is not included, Excel will use the current folder.

The FileFormat parameter specifies the file format to use when saving the file. Its value is one of the XlFileFormat constants described in our discussion of the FileFormat property.

The Password parameter specifies the password to use when saving the file and can be set to any case-sensitive string of up to 15 characters.

The WriteResPassword is a string that specifies the write-reservation password for this file. If a file is saved with a write-reservation password and this password is not supplied when the file is next opened, the file will be opened as read-only.

We can set the ReadOnlyRecommended parameter to True to display a message when the file is opened, recommending that the file be opened as read-only.

Set the CreateBackup parameter to True to create a backup file.

The AccessMode and ConflictResolution parameters refer to sharing issues. We refer the interested reader to the Excel VBA help file for details.

Set the AddToMru parameter to True to add the workbook to the list of recently used files. The default value is False.

The remaining parameters are not used in the U.S. English version of Excel.

0 0

Post a comment