Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
There are several ways to save a workbook. You can save a workbook without changing the path. If the workbook has not been saved before, you should save the workbook by specifying a path. Without an explicit path, Microsoft Office Excel saves the file in the current folder with the name it was given when it was created. You can also save a copy of the workbook without modifying the open workbook in memory.
Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Excel. For more information, see Features available by Office application and project type.
Call the Save method of the ThisWorkbook
class.
Call the Save method to save the active workbook. To use the following code example, run it in the ThisAddIn
class in a VSTO Add-in project for Excel.
You can save the specified workbook to a new location or with a new name, optionally specifying a file format, a password, an access mode, and more.
Note
You might want to set the DisplayAlerts property to False before saving the workbook with a new path because saving in some formats requires interaction. Setting this property to False causes Excel to use all defaults.
Call the SaveAs method of the ThisWorkbook
class. To use the following code example, run it in the ThisWorkbook
class.
Call the SaveAs method to save the active workbook to a new path. To use the following code example, run it in the ThisAddIn
class in a VSTO Add-in project for Excel.
You can save a copy of the workbook to a file without modifying the open workbook in memory. This is useful when you want to create a backup copy without modifying the location of the workbook.
Call the SaveCopyAs method of the ThisWorkbook
class. To use the following code example, run it in the ThisWorkbook
class.
Call the SaveCopyAs method to save a copy of the active workbook. To use the following code example, run it in the ThisAddIn
class in a VSTO Add-in project for Excel.
You can use some of the DocumentProperties like the Last Save Time to verify that the save was successful.
Interactively canceling any of the methods that save or copy the workbook raises a run-time error in your code. For example, if your procedure calls the SaveAs method but does not disable prompts from Excel, and your user clicks Cancel when prompted, Excel raises a run-time error.
Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayTraining
Module
Excel automation in Power Automate for desktop - Training
Learn how to use Power Automate for desktop to open, read, and manipulate Excel files with various Microsoft Excel actions.
Certification
Microsoft Office Specialist: Excel (Office 2016) - Certifications
Demonstrate that you have the skills needed to get the most out of Excel 2016 by earning a Microsoft Office Specialist (MOS) certification.