Archive of Mr Excel Message Board
Back to Excel VBA archive index
Back to archive home
Quit MethodPosted by Dennis on July 31, 2001 9:06 AM
I have an excel application that has a simple exit command to quit the application (Application.Quit). Unfortunately, this only closes my workbook and leaves Excel2000 open. It works fine if I remove the following
Private Sub Workbook_BeforeClose(Cancel As Boolean)
but I do not want be prompted to save changes. Does anyone have any suggestions for a nice clean exit routine?
|Check out our Excel VBA Resources
Re: Quit MethodPosted by Russell on July 31, 2001 9:27 AM
Just put code above your application.quit command:
Hope this helps,
Re: Quit MethodPosted by Dennis on July 31, 2001 10:00 AM
I'm still getting the same results. My Excel application will quit but I'm left with Excel open with no worksheets showing. Any other suggestions?
Re: Quit MethodPosted by Russell on July 31, 2001 10:19 AM
Ok, what's happening is that when the workbook closes, the macro closes with it (therefore it never sees the Application.Quit line). I tried reversing the lines and it worked:
Let me know if it doesn't work for you,
Make sure you save your workbook before running code!Posted by Russell on July 31, 2001 10:20 AM
After you change the lines, make sure you save the workbook since you are telling it not to save changes when you quit! : Just put code above your application.quit command:
Re: Quit Method - It worked!Posted by Dennis on July 31, 2001 12:28 PM
Beautiful! Thanks for your help Russel.
This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store
to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.