ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   USERFORM X BUTTON (https://www.excelbanter.com/excel-programming/400665-userform-x-button.html)

Greg B[_11_]

USERFORM X BUTTON
 
Hi all,

I am wondering what code do I need to stop the userform closing when the X
button is clicked?

Thanks in advance

Greg



Tom Ogilvy

USERFORM X BUTTON
 


Something like this:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
End If
End Sub

--
Regards,
Tom Ogilvy


--
Regards,
Tom Ogilvy


"Greg B" wrote:

Hi all,

I am wondering what code do I need to stop the userform closing when the X
button is clicked?

Thanks in advance

Greg




Greg B[_11_]

USERFORM X BUTTON
 
Thank you for your answer

Greg

"Tom Ogilvy" wrote in message
...


Something like this:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
End If
End Sub

--
Regards,
Tom Ogilvy


--
Regards,
Tom Ogilvy


"Greg B" wrote:

Hi all,

I am wondering what code do I need to stop the userform closing when the
X
button is clicked?

Thanks in advance

Greg







All times are GMT +1. The time now is 11:02 AM.

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