Hello,
I would like to create a class module to simplify my procedure. These are ComboBoxes that depend on the GotFocus event.
I started, somehow, to deal with the problem, but it didn't work.
How to do it ?
Hello,
I would like to create a class module to simplify my procedure. These are ComboBoxes that depend on the GotFocus event.
I started, somehow, to deal with the problem, but it didn't work.
How to do it ?
Hi there,
I haven't read your code in detail, but it seems that you're trying to use the GotFocus event in a Class module which contains a ComboBox object declared WithEvents.
Unfortunately (as far as I am aware) the GotFocus event is not exposed in such a situation. When you place the cursor inside your "CBL_Click" routine you can see the list of available events in the dropdown list at the top of the VBA Editor window (GotFocus is not included).
I had a similar requirement some years ago and I found that an excellent solution had been developed by Jaafar Tribak; it can be found using the following link:
Hope this helps you - it certainly helped me!
Regards,
Greg M
Hello Greg M,
I looked a bit on other forums, actually it does not seem to be possible.
I will try to go through Click instead of GotFocus. But it is not won ...
Last edited by Magic_Doctor; 09-28-2021 at 11:22 PM.
Hi again,
I looked a bit on other forums, actually it does not seem to be possible.
But I think that it very definitely IS possible!
Take a look at the attached workbook and see if it gets you moving in the right direction. Select/tab through the various controls on the UserForm and see how the ComboBoxes respond when they receive or lose the focus.
The VBA CodeModule for the UserForm contains the following code:
And a Class Module called "C21_WatchFormControls" contains the following code:Please Login or Register to view this content.
Please Login or Register to view this content.
As I mentioned in my original post, I'm happy to acknowledge that the idea behind the above code came from Jaafar Tribak.
By the way, I just love the lists of "ingredients" in your ComboBox dropdown lists.
Hope this helps - please let me know how you get on.
Regards,
Greg M
Administrative Note:
We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.
Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.
(Note: this requirement is not optional. No help to be offered until the link is provided.)
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
Forum Rules (updated August 2023): please read them here.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks