End routine by clicking 'X' on Userform
Hello,
I have a routine which calls a Userform. On the userform someone can make a choice. After that the routine continues. But I want to stop the complete routine if someone clicks on the 'X' at the right corner. How to? Exit sub won't work this only stops the userform and the main routine still continues. Arnie |
End routine by clicking 'X' on Userform
Click on the userform and select view code; from the dropdow box on the code
section select Userform, then from the events dropdow select Terminate You will get the following: Private Sub UserForm_Terminate() End Sub Type End in between the Sub and end Sub instructions If this posting was helpful, please click on the Yes button. Regards, Michael Arch. "Arnie" wrote: Hello, I have a routine which calls a Userform. On the userform someone can make a choice. After that the routine continues. But I want to stop the complete routine if someone clicks on the 'X' at the right corner. How to? Exit sub won't work this only stops the userform and the main routine still continues. Arnie |
End routine by clicking 'X' on Userform
Thanx!
"Michael" schreef in bericht ... Click on the userform and select view code; from the dropdow box on the code section select Userform, then from the events dropdow select Terminate You will get the following: Private Sub UserForm_Terminate() End Sub Type End in between the Sub and end Sub instructions If this posting was helpful, please click on the Yes button. Regards, Michael Arch. "Arnie" wrote: Hello, I have a routine which calls a Userform. On the userform someone can make a choice. After that the routine continues. But I want to stop the complete routine if someone clicks on the 'X' at the right corner. How to? Exit sub won't work this only stops the userform and the main routine still continues. Arnie |
End routine by clicking 'X' on Userform
Never use the 'End' statement.
Look at the QueryClose Event in the Userform and help. If still not sure how to terminate your app cleanly describe what is running, eg code returns to the routine that show'd a Modal Userform, other forms still running, etc. Regards, Peter T "Arnie" wrote in message el.net... Thanx! "Michael" schreef in bericht ... Click on the userform and select view code; from the dropdow box on the code section select Userform, then from the events dropdow select Terminate You will get the following: Private Sub UserForm_Terminate() End Sub Type End in between the Sub and end Sub instructions If this posting was helpful, please click on the Yes button. Regards, Michael Arch. "Arnie" wrote: Hello, I have a routine which calls a Userform. On the userform someone can make a choice. After that the routine continues. But I want to stop the complete routine if someone clicks on the 'X' at the right corner. How to? Exit sub won't work this only stops the userform and the main routine still continues. Arnie |
All times are GMT +1. The time now is 07:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com