Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Auto Close and Save

Hi everyone. Hopefully this is an easy question to answer:

I want to set an automatic macro to close the file and exit excel.

I also want another one, which prompts the user to save the file an
then close.

Any ideas ?

Thanks
Scott

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Auto Close and Save

Hi Scott
Sub CloseFileAndExit()
ThisWorkBook.Close(True) 'Or false if you do not wish to save (since you did
not mention)
Application.Quit
End Sub

Sub SaveAndClose()
Do While Application.Dialogs(xlDialogSaveAs).Show = False
Loop
ThisWorkbook.Close
Application.Quit
End Sub

HTH
Cordially
Pascal


"scottwilsonx " a écrit dans
le message de ...
Hi everyone. Hopefully this is an easy question to answer:

I want to set an automatic macro to close the file and exit excel.

I also want another one, which prompts the user to save the file and
then close.

Any ideas ?

Thanks
Scott.


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Auto Close and Save

Pascal, thanks for the code you kindly sent thru. Works perfectly!

Much obliged.

Scott

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Auto Close and Save

Glad it helped

Cordially
Pascal

"scottwilsonx " a écrit dans
le message de ...
Pascal, thanks for the code you kindly sent thru. Works perfectly!

Much obliged.

Scott.


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



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
Auto save and close Frank Excel Worksheet Functions 0 November 19th 09 10:50 AM
Auto save as text and close in code? GD New Users to Excel 2 May 18th 09 08:33 PM
Auto run maco/change behavior of save/close m schmitz Excel Discussion (Misc queries) 0 February 10th 06 04:00 AM
Auto Open, Refresh, Save, Close Jimmycooker Excel Discussion (Misc queries) 0 February 6th 06 01:34 PM
Auto-save worksheet on close? [email protected] Excel Discussion (Misc queries) 1 January 2nd 06 02:12 PM


All times are GMT +1. The time now is 06:56 AM.

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

About Us

"It's about Microsoft Excel"