• Mousewheel in IDE Update (VB 6, VBA 6.0)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Mousewheel in IDE Update (VB 6, VBA 6.0)

    Author
    Topic
    #407289

    Wow! When did the first mouse wheel appear? The first IntelliMouse with scroll wheel is from 1996, so it only took them 8 years…

    Viewing 1 reply thread
    Author
    Replies
    • #850692

      An update to an issue that was never resolved satisfactorily in several previous threads: Mousewheel not functioning in the VB or VBA IDE. Microsoft has finally seen fit to provide an explanation, and better yet, a solution to this annoyance, that does NOT involve having to buy one of their optical mice or installing the MS optical mouse drivers. See MSKB article 837910:

      Mouse wheel events do not work in the Visual Basic 6.0 IDE

      According to article, cause of problem is: “Mouse wheel support in Visual Basic 6.0 is a function of the mouse driver. The WM_MOUSEWHEEL message is sent to the Focus window when you rotate the mouse wheel. Because the Visual Basic 6.0 IDE does not have built-in support for scrolling by using the mouse wheel, the IDE ignores the WM_MOUSEWHEEL message.” To fix problem w/o having to install the MS Intellipoint drivers, article provides a link to download a compiled ActiveX .DLL you can register on your system, along with the VB6 project files with source code, in case you want to compile your own version of the project. Note that the .DLL provided by MS only works in VB6 IDE, not the VBA VB Editor IDE. To enable the mousewheel in VBA, make copy of project files, open project in VB6, double-click the Addin Designer module (Connect.Dsr). In Addin Designer dialog’s “Application” list, select “Visual Basic for Applications IDE” instead of “Visual Basic”, modify description, etc, as desired to reflect VBA vice VB. Save project, then compile as new .DLL (“Make…” on File menu). The new component will automatically be registered on your system. If distributing to other machines, register using regsvr32.exe as described in MSKB article. You should see “Mousewheel Fix” listed in the VBE Add-in Manager (as designed loads automatically on startup). I tested this on my system at work (WIN 2K, Office 2K, VBA 6.0) where I use Logitech optical mouse, and where mouse wheel has never functioned in VBA VB Editor, and I can now scroll away with impunity in code modules…. smile

      Note the code itself (Main.bas module), which works by hooking the mousewheel messages, requires no modification, as both VB and VBA IDE’s use same Windows class (“wndclass_desked_gsk”) and both include “Microsoft Visual Basic” in the Windows caption.

      HTH

      • #851405

        Hi, just wanted to say a THANKYOU!! for this post as it not only showed me how to sort out an (age old) problem – ie. scrolling in the VBE, but also along the way it showed me about compiling a .dll etc.!
        The education continues, and my VBA now scrolls, what a satisifying day!!

        bravo bravo bravo

        Woody’s Lounge – Solid man. cheers

        • #851600

          Glad this helped – I use an MS mouse at home (scroll wheel has always worked in VB Editor) but Logitech at work (scroll wheel did not work). While at work, I’d always being scrolling mouse wheel out of habit (like a dummy) in VBE and of course nothing would happen. This was always a MAJOR annoyance. I’m glad MS published a fix (at long last) but as HansV noted, mousewheels have been around a long time, you’d think Microsoft, with its armies of allegedly brilliant developers, would have fixed this in the first place – apparently a simple window hook procedure solves problem… anyway better late than never…. mice

          • #851611

            I use an MS mouse at work which worked intermittently at best with scrolling in the IDE (VB or VBA) but now it appears to work flawlessly so a big thanks to you! bow
            Wonderful that Access developers have to contrive ways to disable the scrollwheel in forms while trying to re-enable it in other apps! grin

            • #851963

              Only those who want to use the blasted thing! I make every effort to avoid it. shrug

            • #851964

              Only those who want to use the blasted thing! I make every effort to avoid it. shrug

          • #851612

            I use an MS mouse at work which worked intermittently at best with scrolling in the IDE (VB or VBA) but now it appears to work flawlessly so a big thanks to you! bow
            Wonderful that Access developers have to contrive ways to disable the scrollwheel in forms while trying to re-enable it in other apps! grin

          • #856179

            Aagghh! It doesn’t work for me, what am I doing wrong? Yes I get scrolling but its almost uncontrollable. Scrolling doesn’t stop when I want it to and I can wait for ages whilst my code scolls past where I wanted to stop. Worse, my natural reaction is to scroll the other way, so when the first scrolling finishes my code then scrolls back past where I started.

            It seems that instead of scrolling stopping when I release the mouse, I’ve ‘dialed in’ a set amount of scrolling. And its so slow.

            How do I rid myself of this dll?

            • #856184

              The VB code window by default ignores the mouse wheel event. The DLL makes the VB code window “aware” of this event. The mouse wheel then should work the same way as in other applications. You can set some of its behavior in the Mouse control panel, for example the number of lines to scroll with a single notch of the mouse wheel.
              You can turn off the add-in by selecting Add-In | Add-In Manager, and clearing both check boxes for the MouseWheel Fix.

            • #856198

              Hi Hans

              The mousewheel DOES NOT work for me the same in the VBE as it does in other apps. If I scroll here in the lounge the screen scrolls; when I stop moving the mousewheel the scrolling stops. It’s virtually instant. Within the VBE if I move the mousewheel 10 clicks (set at 3 lines per click) it will scroll 30 lines and won’t stop until it has completed them.

              Thanks for the ‘how to’ get rid of.

            • #856199

              Hi Hans

              The mousewheel DOES NOT work for me the same in the VBE as it does in other apps. If I scroll here in the lounge the screen scrolls; when I stop moving the mousewheel the scrolling stops. It’s virtually instant. Within the VBE if I move the mousewheel 10 clicks (set at 3 lines per click) it will scroll 30 lines and won’t stop until it has completed them.

              Thanks for the ‘how to’ get rid of.

            • #856185

              The VB code window by default ignores the mouse wheel event. The DLL makes the VB code window “aware” of this event. The mouse wheel then should work the same way as in other applications. You can set some of its behavior in the Mouse control panel, for example the number of lines to scroll with a single notch of the mouse wheel.
              You can turn off the add-in by selecting Add-In | Add-In Manager, and clearing both check boxes for the MouseWheel Fix.

          • #856180

            Aagghh! It doesn’t work for me, what am I doing wrong? Yes I get scrolling but its almost uncontrollable. Scrolling doesn’t stop when I want it to and I can wait for ages whilst my code scolls past where I wanted to stop. Worse, my natural reaction is to scroll the other way, so when the first scrolling finishes my code then scrolls back past where I started.

            It seems that instead of scrolling stopping when I release the mouse, I’ve ‘dialed in’ a set amount of scrolling. And its so slow.

            How do I rid myself of this dll?

        • #851601

          Glad this helped – I use an MS mouse at home (scroll wheel has always worked in VB Editor) but Logitech at work (scroll wheel did not work). While at work, I’d always being scrolling mouse wheel out of habit (like a dummy) in VBE and of course nothing would happen. This was always a MAJOR annoyance. I’m glad MS published a fix (at long last) but as HansV noted, mousewheels have been around a long time, you’d think Microsoft, with its armies of allegedly brilliant developers, would have fixed this in the first place – apparently a simple window hook procedure solves problem… anyway better late than never…. mice

      • #851406

        Hi, just wanted to say a THANKYOU!! for this post as it not only showed me how to sort out an (age old) problem – ie. scrolling in the VBE, but also along the way it showed me about compiling a .dll etc.!
        The education continues, and my VBA now scrolls, what a satisifying day!!

        bravo bravo bravo

        Woody’s Lounge – Solid man. cheers

      • #851552

        Thanks a lot !!

      • #851558

        Thanks a lot !!

      • #851566

        I haven’t got VB6 installed, could anyone post the VBE dll here with some instructions on how to install?

        • #851568

          Edited by HansV to replace attachment that was lost in server crash

          The attached zip file contains the compiled DLL for the VBA editor (in Word, Excel etc.), named VBAIDEMouseWheelAddin.dll.
          Unzip the DLL to a folder of your choice.
          Select Start | Run…
          Type regsvr32 "C:pathVBAIDEMouseWheelAddin.dll" (substitute the correct path) then press Enter.
          That should install the add-in; open the Visual Basic Editor in any Office application to test.
          You can turn the add-in on and off by selecting Add-Ins | Add-In Manager in the Visual Basic Editor.

          • #851591

            Thanks Hans.

          • #851592

            Thanks Hans.

          • #851727

            Hans,

            Thanks for posting the VBA version, I no longer have to feel stupid when I go into the VBA editor and use the scroll wheel out of force of habit.

          • #851728

            Hans,

            Thanks for posting the VBA version, I no longer have to feel stupid when I go into the VBA editor and use the scroll wheel out of force of habit.

          • #916572

            Hans,
            I tried to install and it fails with error code 0xB0004005. I have Excel 97, so maybe it does not have VBA 6(?). Is there anything I can do to get the scroll wheel working in VBA?

            Thanks,
            Chuck

            • #916576

              Office 97 was built on VB5 and as I recall there was no built in scroll wheel support in that version. Even in VBA6 (Office 2000 and above), support for the scroll in the IDE only comes with the recent patch.

            • #916578

              Charlotte,
              Thank you kindly for the speedy reply. I will wait til I can get upgraded at work.
              Chuck

            • #916577

              Office 97 was built on VB5 and as I recall there was no built in scroll wheel support in that version. Even in VBA6 (Office 2000 and above), support for the scroll in the IDE only comes with the recent patch.

            • #916579

              Chuck,

              The VBA in Office 2000 and up is based on VB6, while the VBA in Office 97 is based on VB5.

              The DLL I attached has been compiled for the Visual Basic Editor in Office 2000 and up. The VB6 compiler I am using does not provide an option to create a DLL for the Visual Basic Editor in Office 97, so I’m afraid I can’t help you. Sorry.

          • #916573

            Hans,
            I tried to install and it fails with error code 0xB0004005. I have Excel 97, so maybe it does not have VBA 6(?). Is there anything I can do to get the scroll wheel working in VBA?

            Thanks,
            Chuck

          • #1100836

            Update: I didn’t notice this before because I have the VBAIDEMouseWheelAddin.dll installed on all PCs I work on, but one of the Office updates during the second half of 2007 has enabled using the mouse wheel to scroll in the Visual Basic Editor in Office XP and 2003 (it was already enabled in Office 2007, and I don’t know about Office 2000).

            So VBAIDEMouseWheelAddin.dll isn’t needed any more. If you installed it, you can turn it off in Add-Ins | Add-In Manager… in the Visual Basic Editor in any Office application (this will turn it off for all Office applications).
            You can unregister the dll:
            – Select Start | Run…
            – Type the following, substituting the correct path of the dll:

            regsvr32 /u "C:pathVBAIDEMouseWheelAddin.dll"

            – Press Enter.
            – If you wish, you can now delete the dll file.

            • #1100841

              Doesn’t work for me in XP, though I don’t know if our IT department apply all the Office updates.

            • #1100972

              Works for me in Office 2003 SP3 with all patches applied.

              StuartR

            • #1100973

              Does for me too at home using either 2002 or 2003. Must have been an update not applied at work (or maybe a mouse issue).

            • #1106551

              I hate to seem ungrateful, but this doesn’t seem to work all that well — it scrolls half the screen at a time and doesn’t seem to obey the scroll setting of mouse settings.
              Or am I missing something? It wouldn’t be the first time… bananas

              It does seem to scroll less when fewer lines are displayed, but I have to say I preferred VBAIDEMouseWheelAddin. Unfortunately, with the patch applied the addin doesn’t work any more.

              I guess there’s always something for me to complain about. smash

              Kim

            • #1106555

              It works well for me in the Visual Basic Editor in both Office XP (at home) and Office 2003 (at work), however the mouse wheel always scrolls three lines regardless of the settings in the Mouse control panel, and regardless of how many lines are displayed.

            • #1106558

              Hmmm, not for me… I get 13 lines at a time and no apparent way to control them. I do have a Logitech bluetooth mouse with its own interface, but puttering with that doesn’t seem to affect it, either. If I use a different mouse, I still scroll 13 lines at a time. Bummer.

              I have Office 2003 installed except for Outlook 2007. You mentioned that scrolling worked with 07 prior to 03. I wonder if there’s any kind of conflict there?

              Oh well. shrug

              K

            • #1106560

              I have a Logitech USB mouse but I don’t use the Logitech mouse driver; I prefer the default mouse driver built into Windows XP.

              I don’t know if the Office 2003/Outlook 2007 combination causes the problem, but I doubt it.

        • #851569

          Edited by HansV to replace attachment that was lost in server crash

          The attached zip file contains the compiled DLL for the VBA editor (in Word, Excel etc.), named VBAIDEMouseWheelAddin.dll.
          Unzip the DLL to a folder of your choice.
          Select Start | Run…
          Type regsvr32 "C:pathVBAIDEMouseWheelAddin.dll" (substitute the correct path) then press Enter.
          That should install the add-in; open the Visual Basic Editor in any Office application to test.
          You can turn the add-in on and off by selecting Add-Ins | Add-In Manager in the Visual Basic Editor.

      • #851567

        I haven’t got VB6 installed, could anyone post the VBE dll here with some instructions on how to install?

      • #852079

        Mark

        Definately a star post.

        I’ve installed both versions, thanks Hans.

      • #852080

        Mark

        Definately a star post.

        I’ve installed both versions, thanks Hans.

      • #858659

        (Edited by HansV to make URL clickable – see Help 19)

        I like the idea, but if you split a code window horizontally, the mouse wheel makes both panes scroll.
        I found an alternative here: http://www.gasanov.net/VBScroll.htm%5B/url%5D, which scrolls only the active pane,
        and also has some other interesting settings.

        • #858779

          That’s interesting to note – I’ve never noticed this, probably because I’ve never found any use for a “Split” window, in VB IDE or elsewhere (like Excel) where this option is available….

          • #859376

            Mark, you’ve really missed out. For cutting and pasting (VBA code, Word documents, etc.), the “Split” window is Da Bomb!

          • #859377

            Mark, you’ve really missed out. For cutting and pasting (VBA code, Word documents, etc.), the “Split” window is Da Bomb!

        • #858780

          That’s interesting to note – I’ve never noticed this, probably because I’ve never found any use for a “Split” window, in VB IDE or elsewhere (like Excel) where this option is available….

      • #858660

        (Edited by HansV to make URL clickable – see Help 19)

        I like the idea, but if you split a code window horizontally, the mouse wheel makes both panes scroll.
        I found an alternative here: http://www.gasanov.net/VBScroll.htm%5B/url%5D, which scrolls only the active pane,
        and also has some other interesting settings.

      • #859411

        Huge Thank-you exclamation I originally saw this post and assumed it was talking about how to VB respond to the wheel, not how to get the wheel to drive the VB screens. stupidme

      • #859412

        Huge Thank-you exclamation I originally saw this post and assumed it was talking about how to VB respond to the wheel, not how to get the wheel to drive the VB screens. stupidme

      • #868219

        I installed this, and initially loved it, but then noticed a lot of crashiness in Word shortly thereafter, usually while mousewheeling in the VBEditor.
        Some of the crashes don’t even display the typical MS “Oops” dialog — application just plain closes! Lost some good work this way, and I’ve turned it off. Now I’m tryinig to figure out how to excise it all together.

        It’s possible it’s an interaction with one of my other add-ins in Word: RoboHelp, Acrobat and Reference Manager are all loaded. I’ve got a couple of the Office Developer add-ins too, but none of them are currently turned on.

        Anyone else see this happen?

        • #868225

          It might be interaction, although I wouldn’t expect those add-ins to interfere with the Visual Basic Editor.

          I have been using the mouse wheel in the VBE intensively since I installed the add-in a month ago, and I haven’t noticed any negative effect.

        • #868226

          It might be interaction, although I wouldn’t expect those add-ins to interfere with the Visual Basic Editor.

          I have been using the mouse wheel in the VBE intensively since I installed the add-in a month ago, and I haven’t noticed any negative effect.

        • #868895

          Hello all,

          Came across the following while trying to find a way to get the scroll wheel to work in FrameMaker. As a bonus, it makes the scroll wheel work in the VBA IDE as well, and offers a few extra bells and whistles. Freeware.

          http://www.geocities.com/SiliconValley/2060/freewheel.html%5B/url%5D

          Enjoy!

      • #868220

        I installed this, and initially loved it, but then noticed a lot of crashiness in Word shortly thereafter, usually while mousewheeling in the VBEditor.
        Some of the crashes don’t even display the typical MS “Oops” dialog — application just plain closes! Lost some good work this way, and I’ve turned it off. Now I’m tryinig to figure out how to excise it all together.

        It’s possible it’s an interaction with one of my other add-ins in Word: RoboHelp, Acrobat and Reference Manager are all loaded. I’ve got a couple of the Office Developer add-ins too, but none of them are currently turned on.

        Anyone else see this happen?

    • #850693

      An update to an issue that was never resolved satisfactorily in several previous threads: Mousewheel not functioning in the VB or VBA IDE. Microsoft has finally seen fit to provide an explanation, and better yet, a solution to this annoyance, that does NOT involve having to buy one of their optical mice or installing the MS optical mouse drivers. See MSKB article 837910:

      Mouse wheel events do not work in the Visual Basic 6.0 IDE

      According to article, cause of problem is: “Mouse wheel support in Visual Basic 6.0 is a function of the mouse driver. The WM_MOUSEWHEEL message is sent to the Focus window when you rotate the mouse wheel. Because the Visual Basic 6.0 IDE does not have built-in support for scrolling by using the mouse wheel, the IDE ignores the WM_MOUSEWHEEL message.” To fix problem w/o having to install the MS Intellipoint drivers, article provides a link to download a compiled ActiveX .DLL you can register on your system, along with the VB6 project files with source code, in case you want to compile your own version of the project. Note that the .DLL provided by MS only works in VB6 IDE, not the VBA VB Editor IDE. To enable the mousewheel in VBA, make copy of project files, open project in VB6, double-click the Addin Designer module (Connect.Dsr). In Addin Designer dialog’s “Application” list, select “Visual Basic for Applications IDE” instead of “Visual Basic”, modify description, etc, as desired to reflect VBA vice VB. Save project, then compile as new .DLL (“Make…” on File menu). The new component will automatically be registered on your system. If distributing to other machines, register using regsvr32.exe as described in MSKB article. You should see “Mousewheel Fix” listed in the VBE Add-in Manager (as designed loads automatically on startup). I tested this on my system at work (WIN 2K, Office 2K, VBA 6.0) where I use Logitech optical mouse, and where mouse wheel has never functioned in VBA VB Editor, and I can now scroll away with impunity in code modules…. smile

      Note the code itself (Main.bas module), which works by hooking the mousewheel messages, requires no modification, as both VB and VBA IDE’s use same Windows class (“wndclass_desked_gsk”) and both include “Microsoft Visual Basic” in the Windows caption.

      HTH

    Viewing 1 reply thread
    Reply To: Mousewheel in IDE Update (VB 6, VBA 6.0)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: