Is it posible to hide "X" or close button on a user form? if not could it be disabled ?
Thanks For Any Help
Is it posible to hide "X" or close button on a user form? if not could it be disabled ?
Thanks For Any Help
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.[VBA]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[/VBA]
Charlize
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
THANKS FOR THE CODE CHARLISE AND CARL A ,if you do find time to write the codeCharlise ,I would liketo hide the caption bar
As requested ...Originally Posted by BENSON
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:Originally Posted by Charlize
[vba]Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
btnClose_Click
End If
End Sub
[/vba]
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com
_______
Thanks for the idea.Originally Posted by JonPeltier
Charlize