UserForms - disabling the little x

  • Thread starter Thread starter JimBo
  • Start date Start date
J

JimBo

I have forgotten how to disable the little x (top right of a user form) will
someone prompt me please

TIA



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4178 (20090622) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Cancel = True
End Sub
 
Thanks Patrick - Muchly appreciated

Patrick Molloy said:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Cancel = True
End Sub




__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4178 (20090622) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4178 (20090622) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
Just to add, to prevent close if user clicked the little x but allow the
form to close with other ways

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
msgbox "don't close with the little x"
else
Msgbox "bye"
end if
End Sub

Regards,
Peter T
 
Back
Top