Turning off Close Button

A

Ayo

How do I turn-off the X "Close button" on a form so that it looks like a
dialog form
 
N

Norman Jones

Hi Ayo,

To hide the Userform's X icon, try
downloading Stephen Bullen's
FormFun.zip file at:

Stephen Bullen's Excel Page
http://www.oaltd.co.uk/Excel/Default.htm

To disable the icon, in the Userform
module try something like:

'========>>
Private Sub UserForm_QueryClose( _
Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
End If
End Sub
'<<=========

However, preferable would be the
following version wh9ich redirects
the icon to the Userform's cbExit
button: this allows any code linked
to the close button to run, without
annoying the typical user, who
would expect thw icon to close the
form.

'========>>
Private Sub UserForm_QueryClose( _
Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Call cbExit_Click
End If
End Sub
'<<=========
 
A

Ayo

I don't want to disable the icon, I want to hide it completely so that the
userform looks like a splash screen.
 
R

RobN

Norman,

Don't think Stephen has that working for v2007, because I just tried it.

Rob
 
N

Norman Jones

Hi Rob,

You are correct that the NoCloseButton
utility does not work with Excel 2007 (or,
at least in my case, with the Excel 2007 /
Windows Vista combination) .

In this connection, you may note that
Stephen shows the last update of the utility
as 25 November 1998.
 
Top