ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable the x button on a userform (https://www.excelbanter.com/excel-programming/320290-disable-x-button-userform.html)

[email protected]

disable the x button on a userform
 
Hi all,

How can I disable the X (close button) on a userform, or hide it all
together

manythanks

Johny5


Harald Staff

disable the x button on a userform
 
Hi

Disable:

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

I think Hide is a part of FormFun. It's far more complex:
http://www.oaltd.co.uk/Excel/Default.htm

HTH. Best wishes Harald

skrev i melding
oups.com...
Hi all,

How can I disable the X (close button) on a userform, or hide it all
together

manythanks

Johny5




Jon Peltier[_9_]

disable the x button on a userform
 
Rather than disable it, have it call the cancel button's code. That's what users
expect it will do, right?

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
btnCancel_Click
End If
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Harald Staff wrote:

Hi

Disable:

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

I think Hide is a part of FormFun. It's far more complex:
http://www.oaltd.co.uk/Excel/Default.htm

HTH. Best wishes Harald

skrev i melding
oups.com...

Hi all,

How can I disable the X (close button) on a userform, or hide it all
together

manythanks

Johny5






Harald Staff

disable the x button on a userform
 
If you want to get deep.. <g
My experience is that when the X is clicked, it means "this is not what I
expected to see. i don't know or care what this is, but i'm sure it's
useless to me now. make it go away". Which may or may not be the same as
Cancel, depending on what Cancel does. Probably the same thing most of the
times, so you're right.

Best wishes Harald

"Jon Peltier" skrev i melding
...
Rather than disable it, have it call the cancel button's code. That's what

users
expect it will do, right?





All times are GMT +1. The time now is 05:26 PM.

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