ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable or hide the close window icon 'X' in the corner of a userform (https://www.excelbanter.com/excel-programming/311307-disable-hide-close-window-icon-x-corner-userform.html)

Tim[_39_]

disable or hide the close window icon 'X' in the corner of a userform
 
any ideas how to achieve that? I'm sure I've seen it somewhere, but can't
find it in past posts.

thanks

tim



james

disable or hide the close window icon 'X' in the corner of a userform
 

This stops the window being closed and shows a msg

James

Private Sub UserForm_QueryClose(Cancel As Integer,
CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "Please use the Exit button", vbCritical
End If
End Sub


-----Original Message-----
any ideas how to achieve that? I'm sure I've seen it

somewhere, but can't
find it in past posts.

thanks

tim


.


Tim[_39_]

disable or hide the close window icon 'X' in the corner of a userform
 
Thank you. but to explain a little further, i was trying to remove the
button altogether (or disable it, so clicking has no effect), later code in
the module will close it automatically

thanks
tim


"James" wrote in message
...

This stops the window being closed and shows a msg

James

Private Sub UserForm_QueryClose(Cancel As Integer,
CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "Please use the Exit button", vbCritical
End If
End Sub


-----Original Message-----
any ideas how to achieve that? I'm sure I've seen it

somewhere, but can't
find it in past posts.

thanks

tim


.




Tom Ogilvy

disable or hide the close window icon 'X' in the corner of a userform
 
James' method is easiest, but if you want to remove the X, post back.

or go to Stephen Bullen's site and down load formfun.zip from his Excel page

http://www.bmsltd.ie (see menu on the left side of page)

--
Regards,
Tom Ogilvy

"Tim" wrote in message
...
any ideas how to achieve that? I'm sure I've seen it somewhere, but can't
find it in past posts.

thanks

tim





Tim[_39_]

disable or hide the close window icon 'X' in the corner of a userform
 
thank you, i got the desired effect using the QueryClose event of the button
(don't know if its the best way though). the button is still there, but
clicking now has no apparent effect.

regards,

tim


"Tom Ogilvy" wrote in message
...
James' method is easiest, but if you want to remove the X, post back.

or go to Stephen Bullen's site and down load formfun.zip from his Excel

page

http://www.bmsltd.ie (see menu on the left side of page)

--
Regards,
Tom Ogilvy

"Tim" wrote in

message
...
any ideas how to achieve that? I'm sure I've seen it somewhere, but

can't
find it in past posts.

thanks

tim








All times are GMT +1. The time now is 10:55 AM.

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