开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜