17 Replies Latest reply on Feb 15, 2016 9:39 AM by Tim Lewis

    Why does this macro cause SolidWorks to crash?

    Tim Lewis

      I have a macro (attached) that whenever I try to run it give me the following dialogs:

       

      Screenshot_1.jpg

      Screenshot_2.jpg

       

      When I open the VBA editor to create a new script to replace the apparently corrupt one (see previous experience to understand that I have prepared myself for things like this by now), I see that the file I previously tried to open is now accessible:

       

      Screenshot_4.jpg

       

      All of these modules and forms can be viewed and edited, but when I try to run any of them, SolidWorks immediately crashes:

       

      Screenshot_3.jpg

       

      The macro used to work fine until I had the VBA editor open checking something in the macro a few days ago and SolidWorks crashed due to a different reason (I think).  In any case, can anyone explain to me what's going on here?  I've already recovered the file from my backups (I regularly export all modules and forms any time changes are made and I've saved a screenshot of my project references so I can quickly recover from macros getting corrupted), but I've never seen this problem before, and I was wondering if there was any way to prevent it in the future or if it's possible to recover the functionality of the original macro file (in case I forget to save backups and it happens again).