Quit

S

solomon_monkey

OK- so here's my code

Sub quit()
'
'

result = MsgBox("Did you mean to press the 'QUIT' Button?", _
vbYesNoCancel, "QUIT")
If result = vbYes Then
GoTo continue1
Else
MsgBox "Cancelled", vbOKOnly, "QUIT"
GoTo exit1
End If

continue1:

Application.DisplayAlerts = False
Application.quit
Application.DisplayAlerts = True

exit1:

'
End Sub


Anyone know why it still asks me if I want to save changes?

Thanks
 
N

Nigel

Quit is the same as if you quit from the main application menu - an unsaved
workbook will result in the question being asked from a procedure within
VBA.

Use the following line before the quit command.

ThisWorkbook.Saved = True

you might like to simplify you code to this......

Sub quit()
If MsgBox("Did you mean to press the 'QUIT' Button?", _
vbYesNoCancel, "QUIT") = vbYes Then
Application.DisplayAlerts = False
ThisWorkbook.Saved = True
Application.quit
Application.DisplayAlerts = True
Else
MsgBox "Cancelled", vbOKOnly, "QUIT"
End If
End Sub
 
S

solomon_monkey

You are a very sexy little man... and I mean this in a totally non-gay
way!! :)

Thank you muchly!!
 
N

Norman Jones

solomon_monkey said:
You are a very sexy little man... and I mean this in a totally non-gay
way!! :)

Thank you muchly!!
'------------------------------------------------

I find your response to Nigel outrageous: you ask for help and feel it
appropriate to respond in the manner that you have to someone who has
manifestly SOUGHT to assist you!



I would urge you to drop the second part of you appellation because it is
clearly an aspiration too far in your case.



I have no problem with polemic or intelligent invective - indeed either can
be stimulating - but such mind-numbing , fatuous imbecility is asking too
much - even of me.



Shame on you!



I am, however, ineluctably drawn to your prophetic choice of post subject
line: Quit.



Quit? Were you only to take you own advice, I would grieve very little.



I do not seek confrontation, but I am not prepared to subjugate principles
to avoid it.



You are, however, lucky in one small respect - I am in a very good mood
today.



To others in group, I ask to excuse my intemperate, castigatory outburst,
but I had hoped that someone would have made my intervention unnecessary;
in the final analysis, I would have felt diminished and demeaned had I not
responded.



I do not seek confrontation, but I am not prepared *not* to evince my
principles to avoid it



PS: I know nothing of Nigel and have no special axe to grind on his behalf.
 
N

Nigel

Wow! - I just found it amusing. I hope the OP got what he wanted. No
offence taken!
 
S

solomon_monkey

I am entirely relieved you took it in the light hearted manner it was
intended Nigel. Thanks. I did get what I wanted. All good. If anyone
was offended then I'm very sorry I guess.
 
N

Norman Jones

Hi Solomon_monkey,

In the light of your response and Nigel's interpretation, I feel that I must
fully retract.

I apologise for my vitriolic post and ask you to forgive me.

For once, regrettably, intended humour escaped me.
 
W

William Benson

I think, Norman, you should only retract insofar as your assumption it would
offend Nigel. As for solomon_monkey

I want to reassur him
Such comments in this forum
are against all decorum
and I personally abohor 'em
and anyone who's for 'em
I feel obliged to implore him
that since we can't just ignore 'em
that they just rather store 'em.

Thanks.
 

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

Similar Threads

save and exit macro 8
Excel process still shows in TaskManager 7
Case Select 2
help with on error stuff 2
How to Save this? 2
Workbook Close Event 1
User form x button 4
Re: VBA Runs After Application.Quit 11

Top