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.
by Allen Wyatt
(last updated May 8, 2021)
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:
If you want to save the workbook to a file with a new name, use the following basic syntax:
where "filename" is the full name (including a path), in quotes, that you want used for the file.
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.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
When you are working with workbooks to which multiple people have access, it can be helpful to know who has a particular ...Discover More
Want a quick way to access the workbooks you use most often? You can "pin" the workbooks so they can be opened with a click.Discover More
As you work with a workbook (particularly one that contains macros) you may notice that the workbook size can become ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.