Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Simplify Command Button Procedure | Excel Discussion (Misc queries) | |||
Enable Command Button Procedure | Excel Discussion (Misc queries) | |||
Specifying a Command Button on a worksheet as differentiated from one on a UserForm | Excel Programming | |||
Looping procedure calls userform; how to exit loop (via userform button)? | Excel Programming | |||
Userform disappears when you try to initialize from a command button | Excel Programming |