View Full Version : Solved: Hiding the "X" or close button on user form
BENSON
03-05-2007, 12:45 AM
Is it posible to hide "X" or close button on a user form? if not could it be disabled ?
Thanks For Any Help
Charlize
03-05-2007, 12:58 AM
They can both be done. Will give you the disable thing. To hide the caption bar, you'll need some api calls. Have to browse to my collection if you really want this. For now, this one will give a warning when pressing the x on a form.Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "The X is disabled, please use the Close Command Button.", vbCritical
End If
End Sub
Charlize
Carl A
03-05-2007, 08:08 AM
Here is some code to disable the close button on an excel userform with downloadable excel example.
http://www.vbforums.com/showthread.php?t=363931
BENSON
03-06-2007, 12:28 AM
THANKS FOR THE CODE CHARLISE AND CARL A ,if you do find time to write the codeCharlise ,I would liketo hide the caption bar
Charlize
03-06-2007, 06:17 AM
THANKS FOR THE CODE CHARLISE AND CARL A ,if you do find time to write the codeCharlise ,I would liketo hide the caption barAs requested ...
JonPeltier
03-07-2007, 04:51 PM
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "The X is disabled, please use the Close Command Button.", vbCritical
End If
End Sub
The user clicked on the close button to close the form, right? Instead of showing an unnecessary message and making the user make an unnecessary mouse click, simply let the close button (which I'll assume is named "btnClose") close the form:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
btnClose_Click
End If
End Sub
Charlize
03-08-2007, 12:04 AM
The user clicked on the close button to close the form, right? Instead of showing an unnecessary message and making the user make an unnecessary mouse click, simply let the close button (which I'll assume is named "btnClose") close the form.Thanks for the idea.
Charlize
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.