Application quit without displayalerts

H

Hari

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.
 
D

David Adamson

try

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

William

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

(e-mail address removed)

| 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.
|
|
 

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

Top