Query Close code question??

M

Mekinnik

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
 
C

crferguson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top