AnsweredAssumed Answered

Macro to run another Macro file

Question asked by Solidworks Selim on Jun 7, 2015
Latest reply on Jun 13, 2015 by Simon Turner

hello Deepak gupta

hello Keith rice


I could not

Add example

I have to add a macro

you do

It will be like in the picture




Option Explicit
Dim swApp As SldWorks.SldWorks
Dim boolstatus As Boolean

Sub main()

Set swApp = Application.SldWorks
Dim runMacroError As Long
boolstatus = swApp.RunMacro2("c:\test\RunMacroSub.swp", "RunMacroSub1", "main", swRunMacroUnloadAfterRun, runMacroError)

End Sub

Replace "c:\test\RunMacroSub.swp"  with the macro path you want to run.


Replace RunMacroSub1 with the other macro Module name.


Replace main with other macro Procedure name


and finally set the options as swRunMacroDefault OR  swRunMacroUnloadAfterRun