I need to disable to X on a user form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top