Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Saving a Workbook in a Macro.
Written by Allen Wyatt (last updated May 8, 2021)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
If you want to save a workbook under control of your macro, you can use the Save method. This is the same as choosing Save from the ribbon options, so it will display the Save As dialog box if the document you are saving has not been previously saved. The syntax is as follows:
ActiveWorkbook.Save
If you want to save the workbook to a file with a new name, use the following basic syntax:
ActiveWorkbook.SaveAs FileName:="filename"
where "filename" is the full name (including a path), in quotes, that you want used for the file.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10769) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Saving a Workbook in a Macro.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
All good things must come to an end at some point. When you are done sharing your workbook with others, this is how you ...
Discover MoreWhen you are working with workbooks to which multiple people have access, it can be helpful to know who has a particular ...
Discover MoreIf you open a workbook and Excel decides to open additional, unwanted workbooks, it can be bothersome to try to track ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments