ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Close and save all changes (https://www.excelbanter.com/excel-programming/300603-macro-close-save-all-changes.html)

Souljah[_5_]

Macro to Close and save all changes
 
Could anyone write me a macro to close the spreadsheet and prompt t
save changes? I need to link it to a button on my spreadsheet.

thanks for any hel

--
Message posted from http://www.ExcelForum.com


Dennis

Macro to Close and save all changes
 
Surely just clicking the X at the top left will produce
this.

However, if you want a button to do this then create the
button and in the code put ThisWorkBook.Close
If changes have been made then you will be prompted to
save them.

hth
-----Original Message-----
Could anyone write me a macro to close the spreadsheet

and prompt to
save changes? I need to link it to a button on my

spreadsheet.

thanks for any help


---
Message posted from http://www.ExcelForum.com/

.


Souljah[_6_]

Macro to Close and save all changes
 
thats great, but i would like it to close Excel if pos...:

--
Message posted from http://www.ExcelForum.com


Charles

Macro to Close and save all changes
 
Greg,

Try

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
MsgBox "Be Sure You Save Before you close this Program"
ActiveWorkbook.Save
End Sub


Your Friend Charles

Ps it on your copy I sent you

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

Macro to Close and save all changes
 
You'd want to use "Application.Quit" in your code.

But I sometimes have multiple workbooks open at one time. It might be nicer to
just let the user close excel.



"Souljah <" wrote:

thats great, but i would like it to close Excel if pos...:)

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



All times are GMT +1. The time now is 05:24 AM.

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