ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quit (https://www.excelbanter.com/excel-programming/333560-quit.html)

solomon_monkey[_2_]

Quit
 
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


Nigel

Quit
 
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


--
Cheers
Nigel



"solomon_monkey" wrote in message
oups.com...
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




solomon_monkey[_2_]

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

Thank you muchly!!


Norman Jones

Quit
 
"solomon_monkey" wrote in message
oups.com...
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.


---
Regards,
Norman





Nigel

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

--
Cheers
Nigel



"Norman Jones" wrote in message
...
"solomon_monkey" wrote in message
oups.com...
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.


---
Regards,
Norman







solomon_monkey[_2_]

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


Norman Jones

Quit
 

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.

---
Regards,
Norman



"solomon_monkey" wrote in message
oups.com...
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.




William Benson[_2_]

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


"Norman Jones" wrote in message
...

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.

---
Regards,
Norman



"solomon_monkey" wrote in message
oups.com...
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.







All times are GMT +1. The time now is 03:17 PM.

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