Disable Exit button on a UserForm

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
 
M

Mark Lincoln

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.
 

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

Top