Auto Close and Save

  • Thread starter Thread starter scottwilsonx
  • Start date Start date
S

scottwilsonx

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
 
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
 
Pascal, thanks for the code you kindly sent thru. Works perfectly!

Much obliged.

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top