Remove Close Icon ?

M

Malcolm

Hi All

I'd like to remove the close icon on the titel bar and
control the close myself. I can close everything OK but
cannot find a way to remove the X from the title bar.
I am including a button that pops up with an
'You are about to close this application Are You Sure ?'

I can do everything except remove the X

Any ideas please ?

Malcolm
 
P

Patrick Molloy

Alas, you can't remove the 'x'....om my wish list too..

Patrick Molloy
Microsoft Excel MVP
 
G

Guest

Thanks - wrong answer !!!

Is there a way to trap it without closing the window ?

UserForm_Terminate is too late !
 
J

Jon Peltier

Malcolm -

You can use UserForm_QueryClose to see how the form was told to close:

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.", vbInformation
Cancel = True
End If
End Sub

- Jon
 
G

Guest

thx Jon,

I ended up finding it the hard way but you are dead right -
it does exactly what I want and I can now prohibit the
close from the close button !
 
Top