View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] crferguson@gmail.com is offline
external usenet poster
 
Posts: 91
Default 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