Tim Lewis

The VBA editor is completely unreliable and often corrupts my macro files

Discussion created by Tim Lewis on Dec 30, 2015
Latest reply on Dec 30, 2015 by Ivana Kolin

I have stopped relying on the VBA editor to save my work.  It seems the only way to get it to actually update the saved file is to exit the VBA editor and hope a message box pops up asking if you want to save your work, which only happens about 50 percent of the time.  To be clear, I'm not sure why there is even a "Save" button in the UI since it doesn't do anything.  Furthermore, when it actually does save my work, it regularly corrupts the file so it won't open.  Right now, when I try to execute or edit one of my macros, I get the following succession of dialog boxes:






[UPDATE] Actually, when I was attempting to edit this file, evidently it was actually open in some form or another because this is what I now see in the VBA editor when I open it without trying to edit the corrupted macro:



But when I try to open one of the modules, this is what I see:




Trying to open one of the forms results in the "Module not found" dialog popping up again.


Thankfully, I've learned my lesson after having my macros corrupted before and have been using the "Export File..." method anytime I want to save my work, but that still wastes a good bit of my time because now I have to re-add several references that I'm using in my macros that don't get imported when I rebuild the file that's been corrupted.


To be clear, I'm not asking for help to recover lost work.  I can import previously saved files and relatively quickly recover my work.  What I am doing is voicing my frustration about something that regularly wastes my time.  For purposes of completeness, the corrupted file is attached.  If you can find a way to recover its contents that is faster than importing all the included forms and modules and re-adding all the needed references, I'm all ears.  Furthemore, if you can describe a means of reliably getting the SWP file to save (preferrably without corrupting the file, but even if it doesn't improve that, just knowing how to get the SWP file to save when I want it to would be very helpful).


P.S. I'm well aware of the fact that sometimes files get corrupted and can be opened by older versions of SolidWorks.  However, the first time this happened, I sent the corrupted file to SolidWorks help and they tried it on several different versions of SolidWorks, and none of them could open it.  Obviously, the file may be corrupted in a different way this time so that it is possible to open it that way, but I doubt it.  Furthermore, since I only have access to my current version of SolidWorks, that isn't a very good option for me (especially since macros get corrupted so often).