Help. How do I disable a UserForm's close (X) icon?

J

jrlopezp

This may be a really dumb question but how do I disable a UserForm's
close (X) icon? Is this even possible in VBA?

Thanks in advance,

Jose Lopez
 
H

Howard Kaikow

Private Sub UserForm_QueryClose(Cancel As Integer, UnloadMode As Integer)
'Prevent user from closing with the Close box in the title bar.
If UnloadMode = vbFormControlMenu Then
Cancel = 1
MsgBox "Please use the " & Mid$(btnExit.Caption, 1) & " button to
close the Form", _
vbInformation + vbOKOnly, "Close box cannot be used to close the
Form"
End If
End Sub
 
J

jrlopezp

Howard,

Thanks for the workaround. This took care of my question.

Best regards,

Jose Lopez Portillo
 

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