All Public Variables in VBA Macros in my office stopped working this morning

What happened: I opened up a macro this morning to work on expanding it. I ran it to check it was still working. it threw an "automation error".

[side note](I've always been used to being able to see my global variables in my locals window. In a nice pull down tab under the module name. It turns out, that only happens when you publicly declare them in the module you're viewing. I did not know this, and my new macro has all my public variables in their own separate module)[return]

So, I debugged my code, had a look for why this worksheet object was throwing an error and saw: <No Variables> in my locals window where my public variables always used to be. Naturally, I panicked. I figured the program must've stopped referencing public variables in other modules. I checked all the other computers in my office, same thing. I frantically searched the internet. Nothing on this. In desparation, I turned to Stack Overflow and Server Fault and Super User and the chat room at Code Review. No luck.

Then I really panicked. I willingly phoned Microsoft tech support.

Needless to say, this went so badly that I gave up. Went away for a bit and took out my frustrations on an empty floor of our building with my katana (LARP safe, so no actual damage to the building).

Then I came back, went back to chat, talked to some more people, tried some more stuff and finally found out the thing about the locals window, which allowed me to find the actual problem with my code:

My macro was closing a workbook before a point in the code where I was trying to reference its worksheets. That was it.

In all, I wasted an entire workday trying to fix a problem that didn't exist.

So, here's a list of things I could have done / should have been doing that would have prevented this:

Version Control: Specifically, being able to revert code to a previous point in time when it was known to be working. This would have immediately demonstrated that my code from e.g. the day before still ran as expected.

The Watch Window: in the VBA IDE this allows you to specify variables and track their status throughout the entire macro. this would have shown me that my variable still existed, it was still being referenced, it just suddenly got emptied at a point in the code.

Actually running the old macros: Because I thought the locals window showed public variables too, and they weren't there. all I did on other computers was step into a macro, see that they weren't there, and assumed the worst. If I had actually just run any of my macros from even a day before, this problem would have been averted.

TDD / Unit Testing: Would've caught my mistake almost the moment I introduced it, and certainly within minutes of writing it, which would have provided a big hint about what had gone wrong and prevented this whole thing before it even started.

Not Panicking: I forgot / didn't try a lot of really obvious things, any one of which would have proved my theory wrong. Instead, because I thought I had a problem, I went looking only for evidence that would confirm it, not for evidence that would disprove it.

On the plus side, at least I am now much wiser than I was this morning.