First of all the question as it originally stood was way below acceptable quality standards, it simply posted some random lines of code with no explanation at to what the intention was, what it actually achieved, or what was going wrong. You are right that it should have been closed, whether for low quality or being off-topic.
This is one of those murky areas where SU wades across the border to SO. In general we allow some light VBScript and VBA questions as they are often used by power users to automate Office and Windows tasks, though for the latter there are often better tools these days. As these are somewhat murky waters we often waive the off-topic nature of the question if it is obvious that the user has a specific problem and can be answered quickly and succinctly without needing multiple answers and chains of back-and-forth comments.
The question quality itself has been raised, but from the comments it is quite clear that is either beyond the tools they have available or their skill to use said tools properly.
There is too much evidence for this being a fundamental lack of understanding as to the limitations and language of the tools, that they do not know even how to see that there is a problem let alone diagnose it and that in all likelihood the script was copied from somewhere without knowledge of what it did or how it worked. The answer it received puts it quite plainly:
if you removed "on error resume next", you would have
seen this error immediately
It is mostly off-topic here but it was (and still is) too low quality to migrate. SO expects more than pluck and determination, they expect a minimum level of knowledge about the tools they are using and what they need to achieve.
In this case though the user literally does not know that they do not know enough about the problem in order to solve it and that is not going to get them far on any Stack Exchange site.
While it is somewhat depressing the best thing we can do is suggest that what they really need is a book or a training course on programming, not someone to "fix their problem" for them.