Why does this macro cause SolidWorks to crash?

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

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:

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

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).

SolidworksApi macros