What is the simplest way to run a macro from a command button on a userform within another macro?
What is the simplest way to run a macro from a command button on a userform within another macro?
On the button click, use RunMacro2
Private Sub ButtonName_Click()
swApp.RunMacro2 "Macro Full Path", "Module Name", "Procedure Name", swRunMacroUnloadAfterRun, runMacroError
End Sub
Can you share the macros, I mean both macro files to see hat wrong. OR create dummy macros and share that.
Deepak,
All my macros that run without user input seem to run fine, however i have one that pups up an additional Userform.
Running this one i get the:
Run-time error "402"
Close or hide topmost modal form.
How can i include this particular Macro that is causing the error (without altering it). it runs fine when i run it normal, and not from inside the other macro.
You can set the modal property of the initial userform in that macro to false or try using me.Hide when click/showing the next userform..
Deepak,
How would i use me.Hide in the first userform with the second userform in a different macro that the first userform is initiating?
Deepak,
Sorry for the delay, been super busy. Here is the loader/launcher. First button runs a macro that has its own userform, the second runs a simple recorded macro. the simple recorded one works fine. The first one gave me the modal error.
I would like to not alter the macros being launched if possible.
As always thanks for the input/assistance.
On the button click, use RunMacro2