+ Reply to Thread
Results 1 to 5 of 5

Mouse scroll in UserForm ListBox - runtime error 91

  1. #1
    Registered User
    Join Date
    03-05-2008
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    56

    Mouse scroll in UserForm ListBox - runtime error 91

    Hi All,

    I have used this code from Peter Thornton from this post and works perfectly for my Combi and List boxes, but when I have the visual basic editor open I get a runtime error 91 - Object variable or block variable not set. When the visual basic editor is closed the error does not appear.

    https://social.msdn.microsoft.com/Forums/en-US/7d584120-a929-4e7c-9ec2-9998ac639bea/mouse-scroll-in-userform-listbox-in-excel-2010

    Anyone got any ideas as why this happens only when the visual basic editor is open?

    Thanks

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,545

    Re: Mouse scroll in UserForm ListBox - runtime error 91

    I will not tell you why this is so. I can only advise you not to do it in the future. If you need to edit your code and / or test while it is executing, disable the hook first. You know this works, so turn it off while testing.

    Artik

  3. #3
    Registered User
    Join Date
    03-05-2008
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    56

    Re: Mouse scroll in UserForm ListBox - runtime error 91

    Thanks Artik, I was just curious as to why the runtime error 91 appears only when the VB editor is open.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Mouse scroll in UserForm ListBox - runtime error 91


    Hi,

    as the error occurs according to your code design …

  5. #5
    Registered User
    Join Date
    03-05-2008
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    56

    Re: Mouse scroll in UserForm ListBox - runtime error 91

    Ok, so I'm assuming that means something is wrong with the code?

    I'm no way an expert and have copied a lot of the code from the link I provided in the first post.
    Can anyone have a look at the code and suggest anything that could be causing the runtime error 91 from this?

    If I press the debug button, it points to "HookListBoxScroll Me, Me.PartsListBox". If I then press the stop or End button, Excel crashes.

    Just to let you know this will run in 64Bit Excel only, not 32Bit (I only use 64Bit Excel)

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Thanks very much,

+ 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. [SOLVED] Listbox Scroll using a mouse
    By saravnepali in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2020, 06:22 PM
  2. [SOLVED] Userform Listbox mouse scroll vba
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2018, 04:21 AM
  3. Userform Listbox Move up/down using the Mouse Wheel Scroll
    By alexgoaga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2018, 08:08 AM
  4. [SOLVED] Userform listbox adding rowsource runtime error 380
    By anrichards22 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-11-2016, 02:10 PM
  5. [SOLVED] Mouse scroll on a listbox
    By luizmachado in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2016, 06:44 PM
  6. Scroll Listbox with Mouse
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2012, 06:36 AM
  7. 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