Mouse Wheel scroll userform

  • Hi,


    I was wondering if its actually possible to make the userform scroll using the mouse wheel.


    I am able to find code by Peter Thornton that does this for listboxes and comboboxes by calling a windows api but am yet to find anything that works for the whole userform.


    If anyone knows a way I would greatly appreciate the help.

  • Re: Mouse Wheel scroll userform


    Based on Peter's code, and assuming you have your form set with appropriate scrollheight/height properties:


    Userform code:

    Code
    1. Private Sub UserForm_Initialize()
    2. HookFormScroll Me
    3. End Sub
    4. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    5. UnhookFormScroll
    6. End Sub


    Normal module:

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Mouse Wheel scroll userform


    Re your PM (In future, please post any follow-up questions in the thread ;)), to avoid affecting other programs, try this version:

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Mouse Wheel scroll userform


    Nice that works.


    There is only a slight bug for some people, where they scroll around and then sometimes it just stops scrolling, this also happened with the old code. It would appear it only happens when you scroll up. This doesn't happen to me so I can only guess its a windows version issue or mouse type issue lol.


    I am still surprised this kind of stuff doesn't exist naturally in newer versions of excel.

  • Re: Mouse Wheel scroll userform


    lapo1234,


    Posting questions in threads started by others is known as thread hijacking.
    Always start a new thread for your questions and include links to any other threads you find helpful to clarify your needs.

  • Re: Mouse Wheel scroll userform



    Good day all. I am new to this group but have found it to be very informative. I am trying to use the userform mouse wheel scroll code in an MS Word 2010 form. When I try to compile the program, it gets stuck on the Application.Max and Application.Min properties. These don't seem to be available in MS Word. I would also like to adapt this code for use in a frame within the user form. Any help here would be greatly appreciated,


    Thanks,


    Rich

  • Re: Mouse Wheel scroll userform


    Welcome to the Forum


    Please start your own post. Posting in another member's Thread is known as hijacking and is not allowed here. By all means add a link to a Thread that may be related to your question.