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.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
If you are using Excel as a repository for data used in your business, you may want to figure out a way to make that ...
Discover MoreWhen you open a workbook, Excel displays the worksheet that was visible when the workbook was last saved. You may want, ...
Discover MoreYou may want to add, to your worksheet, the date on which a particular workbook was created. Excel doesn't provide a way ...
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