disable or hide the close window icon 'X' in the corner of a userform

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

any ideas how to achieve that? I'm sure I've seen it somewhere, but can't
find it in past posts.

thanks

tim
 
This stops the window being closed and shows a msg

James

Private Sub UserForm_QueryClose(Cancel As Integer,
CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "Please use the Exit button", vbCritical
End If
End Sub
 
Thank you. but to explain a little further, i was trying to remove the
button altogether (or disable it, so clicking has no effect), later code in
the module will close it automatically

thanks
tim
 
James' method is easiest, but if you want to remove the X, post back.

or go to Stephen Bullen's site and down load formfun.zip from his Excel page

http://www.bmsltd.ie (see menu on the left side of page)
 
thank you, i got the desired effect using the QueryClose event of the button
(don't know if its the best way though). the button is still there, but
clicking now has no apparent effect.

regards,

tim
 

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