ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Restrict dialog box closing (https://www.excelbanter.com/excel-programming/401851-restrict-dialog-box-closing.html)

Patrick C. Simonds

Restrict dialog box closing
 
Is there any way to prevent a user from closing a dialog box by clicking on
the X in the upper right corner?


John

Restrict dialog box closing
 
try this but make sure you have another method to dismiss the form:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode < 1 Then
Cancel = 1
msg = MsgBox("Please Use Cancel Button", 16, "Warning")
End If
End Sub

--
JB


"Patrick C. Simonds" wrote:

Is there any way to prevent a user from closing a dialog box by clicking on
the X in the upper right corner?




All times are GMT +1. The time now is 04:53 PM.

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