Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In a VBA program I load a userform with buttons and combo boxes,
populate the combo boxes, and then show the form. The main subroutine seems to pause execution while the userform is visible, then resumes when the form is hidden. That seems a little weird to me. I mean, what if I wanted the program to continue? What if I wanted it to be reading a whole bunch of data or doing calculations while the user thought about his choices? Is there a way to force it to continue? But that's not the main question. On the userform I have buttons for continue and exit. Continue simply hides the userform. (I can't unload it or else I lose the values chosen in the combo boxes.) I have to have exit do something else. Right now, what I do is have the exit command button set one of the combo box values to an impossible value. Then when control goes back to the main subroutine, if the value is that, I unload the userform and exit sub. Two questions on this: 1) Is there a way to pass a variable without it being a value on the userform? Obviously, I could create a text box on the form, make it invisible, and use that, but it's the same effect. There is probably some way to make a variable "global" or "public" but how do I do that? 2) Is there a way to do this without passing variables. Can I have the Exit button just terminate the main subroutine? The outline of the code appears below. Thanks. ____________________________________ Code behind Sheet1: Private sub mainsub_click() load userform1 userform1.combobox1.additem 1 userform1.combobox1.additem 2 userform1.show if userform1.combox1.value = -1 then exit sub msgbox "The value of userform1 combo box is" & userform1.combobox1.value end sub Code behind userform1: Private sub continue_click() userform1.hide end sub Private sub exit_click() userform1.combobox1.value = -1 userform1.hide end sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
RANK doesn't work . . . I gotta know why | Excel Discussion (Misc queries) | |||
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene | Excel Discussion (Misc queries) | |||
program control | Excel Programming | |||
Calendar Control: Can't exit design mode because control can't be created | Excel Programming | |||
merging excel program with tdc finance program | Excel Programming |