ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Query Close code question?? (https://www.excelbanter.com/excel-programming/400275-query-close-code-question.html)

Mekinnik

Query Close code question??
 
How would I or how could I make the following code close the userform and
open another? I would like the user to be able to use the 'X' window button
to close the user form and open another not close the Macro.

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

[email protected]

Query Close code question??
 
On Oct 30, 11:38 am, Mekinnik
wrote:
How would I or how could I make the following code close the userform and
open another? I would like the user to be able to use the 'X' window button
to close the user form and open another not close the Macro.

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


Could you not just add an Else condition in there? Like:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
Cancel = False
Else
frmWhatever.show
End If
End Sub



All times are GMT +1. The time now is 02:32 PM.

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