Worksheet.SaveAs (Excel)

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

Use strong passwords that combine uppercase and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down.

SaveAs (Filename, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AddToMru, TextCodepage, TextVisualLayout, Local)


Dim strFilename As String: strFilename = 
ActiveSheet.SaveAs Filename:=strFilename

Arguments

The following argument is required

Filename (String) - 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.

Optional arguments

The following arguments are optional

FileFormat (XlFileFormat) - The file format to use when you save the file. For a list of valid choices, see the XlFileFormat enumeration. 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.


Here you can find possible values for

XlFileFormat

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

WriteResPassword - 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 (Boolean) - True to display a message when the file is opened, recommending that the file be opened as read-only.

CreateBackup (Boolean) - True to create a backup file.

AddToMru (Boolean) - True to add this workbook to the list of recently used files. The default value is False.

TextCodepage - Not used in U.S. English Microsoft Excel

TextVisualLayout - Not used in U.S. English Microsoft Excel

Local - 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) (which is typically US English unless the VBA project where Workbooks.Open is run from is an old internationalized XL5/95 VBA project)