X button query

  • Thread starter Thread starter Greg B
  • Start date Start date
G

Greg B

Hi all how can I have it when someone clicks on the X button of any userform
it loads up the userform"main"

Thanks in advance

Greg
 
Hi Greg,

Try inserting this code into the QueryClose event for each form in question:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
main.Show
End If
End Sub

Hope this helps,

Mark
 

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

Similar Threads

Use the X button on a userform 3
X button question 2
Userform question 1
Hide Smart Art in Excel 2007 2
Macro to create Sort buttons 8
Access Dateadd function question.. 0
USERFORM X BUTTON 2
Excel Excel 2007 fails on insert userform 0

Back
Top