PDA

View Full Version : Solved: Can excel disable close button at right corner



zv735
06-03-2007, 11:46 PM
Can excel disable close button at right corner of user-form

Thank you

geekgirlau
06-04-2007, 12:13 AM
AFAIK, no :cry2:

anandbohra
06-04-2007, 12:17 AM
the simplest solution

Private Sub Userform_QueryClose(Cancel As Integer, closemode As Integer)
If closemode = vbFormControlMenu Then
MsgBox "Sorry you must use Cancel or Exit Button"
Cancel = True
End If
End Sub

geekgirlau
06-04-2007, 12:22 AM
Nice solution - I was looking for a "BeforeClose" or "Close" event; no wonder I didn't find it :doh:

anandbohra
06-04-2007, 12:31 AM
Thanks

one more but this wont give any message box

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As _
Integer)
If CloseMode = vbFormControlMenu Then Cancel = True
End Sub

zv735
06-04-2007, 09:17 AM
Superb !!!!!!

Very Very Thank you :bow:

Carl A
06-04-2007, 01:25 PM
If you are interested in a API solution.

http://www.vbforums.com/showthread.php?t=363931

Example download included

zv735
06-04-2007, 08:26 PM
Nice solution : I very Love API Function but i don't know
Where i can learn about API Function ?

Thank you very much !!!!

johnske
06-04-2007, 09:07 PM
Apart from the curiosity value - why bother?

APIs are very useful in doing something that'd otherwise be impossible in the container application, but what's the point in going outside the container applications code to use another applications code to perform actions in the container app when the (original) container app already has an inbuilt native function to perform that very same action? :dunno

Taken to the extreme, one could possibly use a very complex set of APIs to replace all of the ordinary visual basic code in a workbook, but then - what's the point? :devil2:

Carl A
06-09-2007, 05:45 AM
Apart from the curiosity value - why bother?


I have no argument there johnske. But here in the midwest we have a saying. "There is more than one way to skin a Cat" :devil2:

johnske
06-09-2007, 07:20 AM
Down south here we also have a saying - a cat has nine lives, but only one skin :devil2: :rofl:

Carl A
06-09-2007, 06:17 PM
Where i can learn about API Function ?

Here is a list of API functions.

You can also download the API-Guide.

http://allapi.mentalis.org/apilist/apilist.php

zv735
06-10-2007, 07:24 AM
Thank you
THank you :clap: