Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to save and close, then copy file NewSysAdmin Excel Discussion (Misc queries) 2 December 2nd 09 03:24 PM
How to code the Macro to save and close a file? Eric Excel Discussion (Misc queries) 7 June 10th 07 03:28 PM
Macro to save & close all opened files James A Excel Discussion (Misc queries) 1 December 23rd 06 05:16 AM
Close and save macro Gordon Cartwright Excel Programming 2 November 25th 03 12:15 AM
getting same save-on-close macro to work from different networklocations buczacz Excel Programming 0 September 9th 03 05:48 AM


All times are GMT +1. The time now is 01:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"