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, runMacroErrorEnd Sub
Private Sub ButtonName_Click()
swApp.RunMacro2 "Macro Full Path", "Module Name", "Procedure Name", swRunMacroUnloadAfterRun, runMacroError
first problem i was using RunMacro not RunMacro2,
My second was i had format wrong:
swApp.RunMacro2 ("Macro Full Path", "Module Name", "Procedure Name", swRunMacroUnloadAfterRun, runMacroError)
I needed to remove the ( )
Now I'm getting a ByRef argument type mismatch error
Can you share the macros, I mean both macro files to see hat wrong. OR create dummy macros and share that.
haha, fixed it, i forgot:
Dim runMacroError As Long...
Sometimes these Macro's get too long for their own good.
Appreciate the help as always!!
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..
I had tried setting the initial form showmodal to false, but it only hides the initial form.
I don't think I've ever used me.hide
How would i use me.Hide in the first userform with the second userform in a different macro that the first userform is initiating?
I would need the macros to look at.
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.
There is only one macro in it, so I can't check anything.
Also you could add more userforms in the same macro and do the same work instead of having multiple macros
Cad Admin wrote: Here is a new set...Had to get approval to upload the one.
Cad Admin wrote:
Here is a new set...Had to get approval to upload the one.
No bad feeling but all of them are from either forums or other site. So why they still want to hide these. LOL
The Custom Property one was used before i got to the company (don't think i have ever even used it,lol), a few people still use it for non EPDM Vault Jobs.
My bosses want to use the loader to launch the other macros. The ISO_Save works fine(no userform), the other one throws the modal error.
Retrieving data ...