-
Ok, it's unanimous. My class structure stinks, so I'll rethink it. And I thank-you for pointing it out. But meanwhile, the whole thrust of the comments has centered on the bad design and got away from my real question. In a properly designed class structure, where everything is in it's right place and playing it's proper role, is it an Ok idea to use this naming scheme to enable the handlers to be called (or more likely, run) directly from the class? Is there any downside to doing it this way, aside from the obvious one of being locked into a rigid naming convention?
-
No it hasn't been away from your original problem, because your design caused a problem that was totally unnecessary. Recut the design and you have no need to try and call from one class ino another. You should have realised from the thrust of the comments, in which we are unanimous, that it was wrong.
-
The downside is:
- You want to call a specific handler for each button from the class, based on the name of the button
- That requires you to use Application.Run, which takes a string argument (button name + suffix).
- That in turn requires the button handlers to be in a normal module, since you can't call routines in classes that way.
So you end up with:
- A Userform
- A Class module
- A normal module
All tied intricately together.
And all of this to solve the "problem" of having one click event per button, which you end up having in a normal module anyway.
-
Thank-you. That clears it up, and I'm marking this one solved because it's just as valuable (and in this case even more so) to find out that something can't be done, or shouldn't be done for understandable reasons, as it is to get a positive answer.