+ Reply to Thread
Results 1 to 6 of 6

Mouse scroll on a listbox

  1. #1
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Mouse scroll on a listbox

    I'm using this code from Peter Thornton which enables me to scroll in a userform listbox, but every time my mouse goes through the listbox (just moving the cursor to another part of the userform, without even clicking) it "activates" the listbox. Is there any way I can "block" this to happen? I mean, any way that the mouse scroll works only when I click on that down arrow to open the listbox?

    Ps: and I guess it only works for Windows. If this is right, how can I make it to work with Mac's os also?

    This is Peter Thronton's code:
    Please Login or Register  to view this content.
    This is my workbook, if needed:
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Mouse scroll on a listbox

    All the API functions you are using 'Private Declare ...' etc. are 32 bit Windows dependent. New versions of the function calls are needed for 64 bit Windows.

    The API calls do not work on the Mac. According to Jaslake in post #2 of the following thread, you may have success if you use a 3rd party Virtual Windows machine on your Mac: http://www.excelforum.com/excel-prog...el-2011-a.html

    Lewis

  3. #3
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Mouse scroll on a listbox

    Hmm, got it. But how do I solve that problem? I mean, not this mac/windows problem, but moving cursor through the listbox and it doesn't activate one.
    Quote Originally Posted by LJMetzger View Post
    All the API functions you are using 'Private Declare ...' etc. are 32 bit Windows dependent. New versions of the function calls are needed for 64 bit Windows.

    The API calls do not work on the Mac. According to Jaslake in post #2 of the following thread, you may have success if you use a 3rd party Virtual Windows machine on your Mac: http://www.excelforum.com/excel-prog...el-2011-a.html

    Lewis

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Mouse scroll on a listbox

    Control must be active for code to obtain window handle and this hook code is called from mousemove event. Perhaps you may try dropbuttonclick event instead.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Mouse scroll on a listbox

    A while back I was able to get Peter Thornton's code to work with a great deal of help from several people. The files associated with Post #10 in the following thread may help you: http://www.excelforum.com/excel-prog...orm-frame.html

    Lewis

  6. #6
    Forum Contributor
    Join Date
    01-03-2016
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    2016
    Posts
    125

    Re: Mouse scroll on a listbox

    Quote Originally Posted by LJMetzger View Post
    A while back I was able to get Peter Thornton's code to work with a great deal of help from several people. The files associated with Post #10 in the following thread may help you: http://www.excelforum.com/excel-prog...orm-frame.html

    Lewis
    Thank you!!! It worked.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Controlling Scroll in Listbox with Mouse wheel
    By bagullo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2014, 09:05 AM
  2. Replies: 1
    Last Post: 11-16-2013, 06:17 PM
  3. Scroll Listbox with Mouse
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2012, 06:36 AM
  4. [SOLVED] Scroll horizontaly with mouse, create same system used to scroll .
    By frederic in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 10-09-2005, 04:05 PM
  5. my mouse moves diagonally when i scroll on mouse?
    By BKMISHRA in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 AM
  6. my mouse moves diagonally when i scroll on mouse?
    By BKMISHRA in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 AM
  7. [SOLVED] scroll listbox with mouse wheel
    By RB Smissaert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-26-2005, 05:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1