I didn't even know that this was possible. I designed a macro (with help from this forum) that looks up billing codes that we match up against a large number of phone numbers used by our employees. It worked on Friday. When we tried using it on Monday, it didn't work, instead throwing a Run Time Error 429: Cannot Create ActiveX Object when I tried to assign "ThisWorkbook" to an object.
Thinking that there was some sort of update that went through, I started talking to our service desk people, while a fellow co-worker saved the file under a new name to try and tinker with it (we both work with VBA code, I just do so a bit more often.)
When she tried to run it... it worked. Identical code, no changes beyond the filename, but it worked. So, shrugging my shoulders and thinking I must have just introduced a typo by mistake in the course of working with it, I copied the code in the file that worked, and I pasted it over the matching code in the file that didn't.
It still doesn't work.
So I have two pretty-much identical files, running identical code, and one works, but the other doesn't. And I am utterly perplexed at how this is even possible, let alone what happened to make it do this.
Here's my code in the currently-broken original. Note that this code was originally designed for another file, which is why there are a lot of variables I don't even touch, but it's working despite those most of the time. I'm posting every line and character in the module, rather than trying to "file off the serial numbers." There's nothing proprietary or identifiable in here anyway. It processes through to the line "set wbVM = ThisWorkbook" and then throws the Error 429. Except when it doesn't.
Here's my code in the version that actually works:
Why does this work in one file, but not in the other one? Particularly when they're *identical files*? And why would the line "set wbVM = ThisWorkbook" be the line that's causing me to throw the error?
Bookmarks