ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable close button on all froms & MsgBoxes (https://www.excelbanter.com/excel-programming/394700-disable-close-button-all-froms-msgboxes.html)

Haxer

Disable close button on all froms & MsgBoxes
 
Is there a way to disable/hide/something the close buttons in all userforms
and msgboxes in a workbook? If not can you individually disable/hide them in
userforms? MsgBoxes?

MSweetG222

Disable close button on all froms & MsgBoxes
 
On user forms try...

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
'Chg msg text to fit your needs...
MsgBox "Please use the ''OK'' Button.", vbInformation
End If
End Sub


--
Thx
MSweetG222



"Haxer" wrote:

Is there a way to disable/hide/something the close buttons in all userforms
and msgboxes in a workbook? If not can you individually disable/hide them in
userforms? MsgBoxes?


Haxer

Disable close button on all froms & MsgBoxes
 
Thank you...
Do you know if there is a way to globalize this so that I can put it in once
and it will work for all userforms?

"MSweetG222" wrote:

On user forms try...

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
'Chg msg text to fit your needs...
MsgBox "Please use the ''OK'' Button.", vbInformation
End If
End Sub


--
Thx
MSweetG222



"Haxer" wrote:

Is there a way to disable/hide/something the close buttons in all userforms
and msgboxes in a workbook? If not can you individually disable/hide them in
userforms? MsgBoxes?



All times are GMT +1. The time now is 08:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com