Taking out the 'Close Button' in the top right hand corner of dialog boxes

  • Thread starter Thread starter pspyve
  • Start date Start date
P

pspyve

In VBA, is there any way of removing the little X buttons off the dialog
boxes top right hand corner??
 
p,

Do you mean dialog box or do you mean userform?
If a userform then look at the QueryClose event for the form.
You can use that to prevent the form from closing.

Jim Cone
San Francisco, USA


"pspyve"
wrote in message
In VBA, is there any way of removing the little X buttons off the dialog
boxes top right hand corner??
pspyve
 
Hi
This won't remove it, but it will disable it

'Sub suggested in Green, page190
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Application.EnableEvents = False
If CloseMode = vbFormControlMenu Then
MsgBox "Please use only the Cancel button", vbCritical, "This
cancel is disabled"
Cancel = True
End If
Application.EnableEvents = True
End Sub

regards
Paul
 
I know there was an API that removed it - using 97 - and probably would
work for later versions but not something I would recommend unlessyou
know what you are doing. and really need to do this

I am away from home and haven't got the code on me.
 

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

Back
Top