-
I don't understand the problem.
If you want a button handled differently than the class handles it, put the routine for that button in the button's Click event in the userform's code module.
If you have a whole bunch of buttons, all of which are to be handled the same, but differently than (or in addition to) the way the class handles buttons, create a second class for those.
A UF command button can be linked to several classes, and when the button is clicked, the Click event for each of those classes will be run, after that button's Click event (if there is one) in the Userform's code module has run.
Later Edit:
Another approach would be to create a boolean SpecialHandling property of the class.
[VBA]If SpecialHandling Then
Rem do something
End If[/VBA] could be put in your class's Click event where needed. If you need more than two types of buttons SpecialHandling could be a Long variable and Select Case could be used. (Perhaps a text SpecialHandling would be easier for future maintenance)
About the two specific questions in your last post, if you want to know which button is causing the class's click event, classCmdButtons.Name would give you that info.
And if a routine is to be called from another module, that routine should be in a normal module.
I'm working on a project with similar issues; wanting all my controls to do one thing, but some of them to do special things and, after much trashing about with "special case" code, "one class = one function, special cases are handled on their own, outside of the class" got me out of the jungle of code I had come up with.
Last edited by mikerickson; 02-23-2009 at 07:41 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules