ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Disable Exit button on a UserForm (https://www.excelbanter.com/excel-discussion-misc-queries/109880-disable-exit-button-userform.html)

Noemi

Disable Exit button on a UserForm
 
HI
Is there a way to Remove the exit button (X) from the UserForm as I only
want the form to close if the command buttons are selected.

Thanks
Noemi

Mark Lincoln

Disable Exit button on a UserForm
 
Ron de Bruin posted the following to a similar question:

Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Prevents use of the Close button
If CloseMode = vbFormControlMenu Then
MsgBox "Clicking the Close button does not work."
Cancel = True
End If
End Sub

This doesn't remove the Close (what you called Exit) button, but
disables it. I haven't tested it, but I suspect that if you remove the
MsgBox line the Close button will simply not work.

Noemi wrote:
HI
Is there a way to Remove the exit button (X) from the UserForm as I only
want the form to close if the command buttons are selected.

Thanks
Noemi




All times are GMT +1. The time now is 07:28 AM.

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