Disable close button on a Userform 
Author Message
 Disable close button on a Userform

Is it possible to disable or hide the close button (x at
top right of the window) on a Userform, so the Userform
can only be closed by clicking an okay button



Sun, 09 Oct 2005 17:52:32 GMT  
 Disable close button on a Userform
Jason,

You don't need to hide it as there is a QueryClose event that you can
monitor. For instance

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

if fValid is set to False, the close button has no effect. You could throw
up a message, or just ignore that action. This also disables the close on
the form control menu.

--
    HTH

    -------

    Bob Phillips
    ... looking out across Poole Harbour to the Purbecks


Quote:

> Is it possible to disable or hide the close button (x at
> top right of the window) on a Userform, so the Userform
> can only be closed by clicking an okay button



Sun, 09 Oct 2005 18:22:10 GMT  
 Disable close button on a Userform
Hi

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

HTH. Best wishes Harald



Quote:

> Is it possible to disable or hide the close button (x at
> top right of the window) on a Userform, so the Userform
> can only be closed by clicking an okay button



Sun, 09 Oct 2005 18:35:45 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Disable close button in a Userform

2. Disable userform close button

3. J.Walkenbach tip: Disabling use of the Close button in a UserForm

4. Disabling Close Window button in UserForm

5. How to disable the Close Button on a XL97 Userform

6. XL97 UserForms: Disabling Close-Button (X)

7. Disable Access Close Button not Form Close Button?

8. Disabled Close button / What's this button

9. Disable UserForm Close

10. disabling the double click for buttons on a userform


 
Powered by phpBB® Forum Software © phpBB Group