ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Need a "save & close" button directly on spreadsheet (https://www.excelbanter.com/excel-discussion-misc-queries/52531-need-save-close-button-directly-spreadsheet.html)

Ron M.

Need a "save & close" button directly on spreadsheet
 
I need a button which, when clicked, will do a "Save" and close the
file, exactly as if you'd clicked "Save" in the File menu. The thing
is, this needs to be a button directly on the spreadsheet, next to some
other buttons I have on there that run macros, NOT a button on a
toolbar. Is there a macro that will do this that I can connect to a
button?

Thanks,
Ron M.


Anne Troy

Need a "save & close" button directly on spreadsheet
 
Here you go:
Sub SaveAndClose()
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
************
Anne Troy
www.OfficeArticles.com

"Ron M." wrote in message
oups.com...
I need a button which, when clicked, will do a "Save" and close the
file, exactly as if you'd clicked "Save" in the File menu. The thing
is, this needs to be a button directly on the spreadsheet, next to some
other buttons I have on there that run macros, NOT a button on a
toolbar. Is there a macro that will do this that I can connect to a
button?

Thanks,
Ron M.





All times are GMT +1. The time now is 12:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com