9 Replies Latest reply on Jun 13, 2015 5:23 AM by Simon Turner

    Macro to run another Macro file

    Solidworks Selim

      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