ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make a user form 'un-closeable' (https://www.excelbanter.com/excel-programming/299001-make-user-form-un-closeable.html)

peekbo[_3_]

Make a user form 'un-closeable'
 
So now that I figured out how to work underneath a user form - how can
make the box uncloseable?

i.e. Everytime you try to click the 'x' - it displays cannot close

--
Message posted from http://www.ExcelForum.com


Charles

Make a user form 'un-closeable'
 
Ok,

Now you have to add "Done" Button if you want to get rid of th
userform othewise it will always be there. But here is something tha
will cancel the "X". The "X" will still show but when clicked it wil
not close the form.

Heres the code for it.

Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, closemode A
Integer)
If closemode = vbFormControlMenu Then
Cancel = True
End If
End Sub

HTH

Charle

--
Message posted from http://www.ExcelForum.com


peekbo[_4_]

Make a user form 'un-closeable'
 
Thanks again man. Excatly what I was looking for

--
Message posted from http://www.ExcelForum.com


Charles

Make a user form 'un-closeable'
 
Happy to Help

Charles


---
Message posted from http://www.ExcelForum.com/


Andrew[_16_]

Make a user form 'un-closeable'
 
Insert the following in your form code:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim vbResponse As VbMsgBoxResult
vbResponse = MsgBox("Do you want to close this form?", vbYesNo)
If vbResponse = vbNo Then Cancel = True
End Sub

Regards,
Andrew

peekbo wrote in message ...
So now that I figured out how to work underneath a user form - how can i
make the box uncloseable?

i.e. Everytime you try to click the 'x' - it displays cannot close.


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 12:46 AM.

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