开发者

Excel VBA code to SaveAs a specific filename and close the active workbook

开发者 https://www.devze.com 2022-12-12 21:20 出处:网络
What VBA code do I need to add to the end of an existing sub to save the active workbook as \"finalo开发者_如何学运维utput.xls\" and then automatically close the workbook without saving changes?You co

What VBA code do I need to add to the end of an existing sub to save the active workbook as "finalo开发者_如何学运维utput.xls" and then automatically close the workbook without saving changes?


You could use something as simple as this, which I put in another workbook and executed from the Tools...Macros menu (Alt+F8) after activating the workbook to be saved.

Public Sub SaveAsAndClose()

    ActiveWorkbook.SaveAs "finaloutput.xls"
    ActiveWorkbook.Close

End Sub
0

精彩评论

暂无评论...
验证码 换一张
取 消