Disable Exit button on a UserForm

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

Guest

HI
Is there a way to Remove the exit button (X) from the UserForm as I only
want the form to close if the command buttons are selected.

Thanks
Noemi
 
Ron de Bruin posted the following to a similar question:

Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Prevents use of the Close button
If CloseMode = vbFormControlMenu Then
MsgBox "Clicking the Close button does not work."
Cancel = True
End If
End Sub

This doesn't remove the Close (what you called Exit) button, but
disables it. I haven't tested it, but I suspect that if you remove the
MsgBox line the Close button will simply not work.
 
Back
Top