Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having trouble with some basic ideas of userforms.
I want to start a main procedure, fire off a form to collect some data, then return to the main procedure with the data gathered in the form. I would like to use VBA variables to contain the data rather than spreadsheet cells. ----- In the main section of VBA ----- Option Explicit Dim Result$ Sub Main() frmOptionResult.Show MsgBox Result$ End Sub ----- In the UserForm code ----- Private Sub UserForm.Terminate() Result$ = IIF(OptionButton1.Value, "One", "Not One") End Sub Above is what I tried to do thinking that I could collect Result$ in a global variable that could be referenced by 'MsgBox Result$' in Main(). Unfortunatelly, when the form unloads, the Result$ collected goes out of scope. I was closing the form by pressing "X", and that is what fires off 'UserForm Terminate()'. Is there a more common way to do this that preserves the data on the form? Perhaps it needs to be hidden rather than terminated and then unloaded later? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Add Beginning Text | Excel Discussion (Misc queries) | |||
How do i add " to the beginning of all cells | Excel Discussion (Misc queries) | |||
add "0" to the beginning of each value | Excel Worksheet Functions | |||
Zero at the beginning of a number | Excel Discussion (Misc queries) | |||
Calling Forms from Forms - Exit problems | Excel Programming |