ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application quit without displayalerts (https://www.excelbanter.com/excel-programming/301001-application-quit-without-displayalerts.html)

Hari[_3_]

Application quit without displayalerts
 
Hi,

I have a piece of code at the end of which I need to quit excel and in the
process there are some workbooks which were changed but not meant to be
saved. Like I use personal macro folder for performing some operations and
use its output in some other worksheet.

Please note the codes mentioned in this worksheet are part of one of the
modules in the Personal macro folder.

Im reproducing the last 2 lines of the code here ( excluding sub):-

Application.Quit
Workbooks("personal.XLS").Close SaveChanges:=False
End Sub

In the above way the excel closes completely without prompting for changes
and it also doesnt save the personal folder. Im perfectly happy with this
and able to get what I want.

Suppose I juggle the above code to :-

Workbooks("personal.XLS").Close SaveChanges:=False
Application.Quit
End Sub

In this case personal folder closes witout getting saved but excel doent
quit. Does that mean that once the workbook close statement is encountered
then further coding doesnt get processed within the same module.



David Adamson[_3_]

Application quit without displayalerts
 
try

Application.DisplayAlerts = False
ActiveWorkbook.Close savechanges:=False




David Adamson[_3_]

Application quit without displayalerts
 
Application.DisplayAlerts = False
ActiveWorkbook.Close savechanges:=False



William[_2_]

Application quit without displayalerts
 
Once you close "Personal.xls" the code within that workbook stops executing.

Assuming you have no other workbooks open that may need saving, try.....

Workbooks("Personal.xls").Saved = True
Application.Quit

--
XL2002
Regards

William



"Hari" wrote in message
...
| Hi,
|
| I have a piece of code at the end of which I need to quit excel and in the
| process there are some workbooks which were changed but not meant to be
| saved. Like I use personal macro folder for performing some operations and
| use its output in some other worksheet.
|
| Please note the codes mentioned in this worksheet are part of one of the
| modules in the Personal macro folder.
|
| Im reproducing the last 2 lines of the code here ( excluding sub):-
|
| Application.Quit
| Workbooks("personal.XLS").Close SaveChanges:=False
| End Sub
|
| In the above way the excel closes completely without prompting for changes
| and it also doesnt save the personal folder. Im perfectly happy with this
| and able to get what I want.
|
| Suppose I juggle the above code to :-
|
| Workbooks("personal.XLS").Close SaveChanges:=False
| Application.Quit
| End Sub
|
| In this case personal folder closes witout getting saved but excel doent
| quit. Does that mean that once the workbook close statement is encountered
| then further coding doesnt get processed within the same module.
|
|




All times are GMT +1. The time now is 11:10 PM.

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