close all userforms and pass control back to sub
Hi -
I am creating a macro that accepts users input via user forms and then process the data to create an excel spreadsheet data.
The way I designed the macro is to have a sub route in a standard module that calls(shows) a main userform which then determines which other userform to show, based on the user's input to the main userform. In switching between main userform and other userform, I use "hidden" to hide userform. On the main userform, I have created a "finish" command control, so that I can close all user forms and pass the control back to the sub routin in the stand module and runs process the input.
However, I am having problem with accomplish such. I have the following code in my main userform. How do then close the main userform and pass the flow back to the main subroute where I have started? I tried to use "unload " in the code. but it did not work either.
Private Sub CmdFinish_Click() ' in the main user form
If va_fmChemPharm_Hide = True Then
Unload fmChemPharm
End If
If va_fmPreClinical_Hide = True Then
Unload fmPreClinical
End If
If va_fmFunctionMenu_Hide = True Then
Unload fmFunctionMenu
End If
End Sub
Any help, greatly appreciate.
Kathy
|