7 Replies Latest reply on Sep 7, 2015 10:12 PM by Taylor Rucker

    Batch Runner Macro Crashing Unexpectedly

    Taylor Rucker

      Hello again everyone,


      I have the macro I need written, but I need it to run on a lot of drawing files. The macro deletes and inserts new notes, saves the drawing, saves it as a PDF and saves it as a DWG. I used Intercad's Batch Runner to apply the macro to a certain folder.


      This worked great on two computers, but for some reason on the third computer Solidworks crashes during the batch run. Sometimes at the very beginning, sometimes in the middle, and sometimes at the end.


      I have tried running it without saving PDF or DWG, still crashes. I have tried closing all open documents at the end of the macro, still crashes. I have turned off the solidworks resource manager, ( usually 3-6 Gb of memory used out of 16Gb) still crashes.


      I am running the macro via VBA.


      Does anyone have suggestions on how to avoid crashing?


      Thanks in advance,



        • Re: Batch Runner Macro Crashing Unexpectedly
          Taylor Rucker

          This applies to a macro that just saves the drawings in PDF and DWG, I'll attach the macro that I'm trying to batch run. Still crashes every time.

          • Re: Batch Runner Macro Crashing Unexpectedly
            Taylor Rucker

            Thanks for the replies everyone.


            I'm not sure which fix did it, but I tried three things. First I learned a little more about code and cleaned things up quite a bit, much like in Deepak's reply. Second I checked to make sure the save settings in SW were consistent, thanks Tapani. Lastly I ran the batch runner with SW minimized. I have no idea if that helped or not, but it seemed to.


            The only problem I had after processing about 600 drawing files is that some of them had their filename changed. My PC name, date and some other info followed by "conflict" was added. I thought that the lines below would always save the files as their original name, ie no warnings or errors.



            Path = Left(swModel.GetPathName, Len(swModel.GetPathName) - 6)

            swModel.SaveAs3 Path & "PDF", 0, 0

            swModel.SaveAs3 Path & "DWG", 0, 0



            The batch run ended up working good enough but I would like to figure out why some filenames were changed. My best guess is that it has to do with SW crashing in the beginning stages of the process.


            Thanks again everyone,