I need to disable to X on a user form

C

cwwolfdog

I can't figure out how to prevent someone from clicking the close (X) icon on
a user form. I have a cancel button which is what I want them to have to use.

thanks
 
D

Dave Peterson

How about:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Beep
'msgbox "doesn't work"
Cancel = True
End If
End Sub
 
C

cwwolfdog

Thanks Dave,

Worked like a charm.

Dave Peterson said:
How about:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Beep
'msgbox "doesn't work"
Cancel = True
End If
End Sub
 
Top