+ Reply to Thread
Results 1 to 6 of 6

Mouse Scroll Wheel in 64 bit

  1. #1
    Registered User
    Join Date
    01-22-2017
    Location
    Michigan
    MS-Off Ver
    365
    Posts
    61

    Mouse Scroll Wheel in 64 bit

    I've got 32 bit to work flawlessly, but I haven't been able to get 64 bit to work. The problem is that there are so many variations to the code and so it's hard to figure out from the examples how to adjust the code that I'm using. Any help is appreciated! I tried changing the declarations to PtrSafe, but that wasn't enough. I tried changing all of the Long to LongPtr, and it was finally able to run, but not very well- the mouse scroll was all wonky. I just don't know enough about these functions to make all these changes.

    I finally got the chance to upgrade my home computer to 64 bit Excel and I jumped on it!

    I'll include the whole file as an attachment.

    Here's the 32bit code for the mouse (without any changes)

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Soulfien; 10-15-2018 at 12:13 AM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2016 primarily
    Posts
    4,108

    Re: Mouse Scroll Wheel in 64 bit

    Perhaps the code here will help:

    https://www.excelforum.com/excel-pro...se-scroll.html
    Rory
    Sue, you're shouting at tea

  3. #3
    Registered User
    Join Date
    01-22-2017
    Location
    Michigan
    MS-Off Ver
    365
    Posts
    61

    Re: Mouse Scroll Wheel in 64 bit

    Thanks for the reference. I was able to get this code to work, however, this type of scroll wheel function is for very short lists. It works by moving to the next selection rather than moving down the scroll bar itself. This makes for a LOOOOOOOT of scrolling to get through my long lists.

    I'll include the new file for reference. Again, I do appreciate the help. Perhaps I can see how this code works and learn how to adapt my preferred code.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    01-22-2017
    Location
    Michigan
    MS-Off Ver
    365
    Posts
    61

    Re: Mouse Scroll Wheel in 64 bit

    It works! I adapted my code using the example provided!

    Thank you! I will post the finished product here:
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-04-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007, 2010, 2013
    Posts
    6

    Re: Mouse Scroll Wheel in 64 bit

    Quote Originally Posted by Soulfien View Post
    It works! I adapted my code using the example provided!

    Thank you! I will post the finished product here:
    Thanks for posting your file. I've been wanting a mouse wheel scroll that doesn't select anything and so far this is the best I've seen.

    Is that file CSR 54.xlsm you attached the latest one you had? It works in Windows 10 64 bit/Excel 32 bit, but not Excel 64 bit. When I run on 64 bit, it gives an automation error. There's only one "#If Win64 Then" which is commented out I would assume you would need that in other places as well. I'll review Rory's link to see if I can piece together, but wonder if you had a working file for both 32 & 64.

    Also, for others, here is my code where I tweaked the listbox .topindex property, so it will always scroll to the top (seems if the .topindex is negative it wouldn't go to the top). I also need to figure out a way to use the scroll in a large text box and using curpostion, but haven't gotten to that yet. Need this to work in 32 & 64 bit before adding more features!

    Please Login or Register  to view this content.
    Put this in your userform (I put it at the bottom of my Private Sub UserForm_Initialize() event):
    Please Login or Register  to view this content.
    Be sure to change the iGblControlType to the control type you are using and the "Me.lbTrades" to your listbox (or other control) name.

    Put
    Please Login or Register  to view this content.
    before your unload event or in the form QueryClose event.
    Last edited by mikepfly2; 02-14-2020 at 06:18 PM. Reason: formatting

  6. #6
    Registered User
    Join Date
    08-04-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2007, 2010, 2013
    Posts
    6

    Re: Mouse Scroll Wheel in 64 bit

    Ok, so have it working and tested on Windows 10 64bit and Office 16 Excel both 32 bit and 64 bit. Thanks Soulfien and Rorya!
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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