Using the Roulette for a Combobox

Hello

I made an application in which I introduced Comboboxes (list of my articles) but for the moment to scroll through all the articles I have to use the cursor on the right. 
We agree it's pure "gimmick" but I would have liked to know if it was possible to make the use of the roulette wheel possible please? 

Thank you and have a good day

Hello

I don't have the PC in front of my eyes but I'll try to answer you.

Open the form module, at the top left you have an object picker and on the right, an event picker. Choose a combobox in the first one and see if you have an event that corresponds to what you want to do (mousewheel)

If nothing matches, it will have to be coded.

Once it works for one, put the code in a procedure, loop over all the controls on the form, check that it's a combobox , and add a handler that points to the procedure.

That way, all comboboxes will behave the same.

4 Likes

Roub25 I recommend this link :) http://codes-sources.commentcamarche.net/source/54334-vba-molette-souris-combobox-et-listebox-dans-feuille-excel-et-userform

3 Likes

Thank you both!

MaD this would mean that if I want to use the wheel I have to copy all the code "For module" and "For Userform"? I think I'll be satisfied with the cursor because I don't necessarily have the time to understand all the code behind it, let alone my colleagues that I'm going to train:)

Thanks also to you Yves.T I'm going to look at the events.

1 Like

The idea of the Mouse Hook is not stupid at all.

You just need to put the "To put in a module" part in a module and use the HookMousse and UnHookMousse functions as it does at the very bottom of its code.

Otherwise, for events, forget about it because, as I said in my tutorial on macros, VBA does not allow inheritance and does not allow access to certain functions either. So the hook solution is for me the best.

2 Likes