![]() |
How to elegantly end a main procedure from a userform command button?
Hello--I am looking for a tidy way to end a main procedure from a
userform command button. One idea that might work (say the newsgroups) is to to run a boolean function procedure that returns a value, False if certain conditions are met. Then one could check for a false value in the main procedure before continuing. However, I am having trouble connecting userform buttons with function rather than sub procedures. I am sure that this is a common problem. Can anyone suggest an elegant way out? Thanks. -Abe |
How to elegantly end a main procedure from a userform command butt
Whe you click the button have the button click procedure run your boolean
functions to determine the proper course of action... Private Sub CommandButton1_Click() if this = false then exit sub if That = true then msgbox "Sorry but it's time to go now..." else 'do your stuff end if End Sub private function This() as boolean This = True end function private function That() as boolean That = False end function -- HTH... Jim Thomlinson " wrote: Hello--I am looking for a tidy way to end a main procedure from a userform command button. One idea that might work (say the newsgroups) is to to run a boolean function procedure that returns a value, False if certain conditions are met. Then one could check for a false value in the main procedure before continuing. However, I am having trouble connecting userform buttons with function rather than sub procedures. I am sure that this is a common problem. Can anyone suggest an elegant way out? Thanks. -Abe |
All times are GMT +1. The time now is 03:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com