When you use the Microsoft Visual Basic for Applications (VBA) 6 integrated development environment (IDE) — also referred to as the Visual Basic Editor — to add or edit a macro or module in your Microsoft Office 2003 program , the scroll wheel on your mouse might not function. That's because VBA is based on the Microsoft Visual Basic 6 IDE, which does not include built-in support for the scroll wheel. You can use the technique discussed here to add support for the scroll wheel to VBA 6. These instructions are based on the technique found in Microsoft Knowledge Base article 837910: Mouse wheel events do not work in the Visual Basic 6.0 IDE.
Note that the 2007 Microsoft Office system includes built-in support for the scroll wheel.
In this article
What is the scroll wheel?
The scroll wheel is the wheel between the left and right mouse buttons on many mouse products, as shown in the following illustration. In many programs, you can use the wheel to scroll forward or backward in a file. Recent models of mouse products let you scroll from side to side — that is, toward the left or right — in addition to scrolling up and down.
Use the following steps to enable support for the scroll wheel in VBA 6.
Download and extract the support files
The support files you need can be found in the VB6MouseWheel.exe download package. You must download and extract these files in preparation for the next step.
- Download the VB6MouseWheel.exe package. This package includes the support files you will need to enable the scroll wheel. VB6 Mouse Wheel Fix.
- Run VB6MouseWheel.exe to extract the files in the package. You might see a security warning that asks if you want to run this file. If you see the warning, click Run.
- When the VB6 Mouse Wheel Fix dialog box appears, read the End User License Agreement (EULA) and, if you agree to its terms, click Yes to install the package.
- When the extractor appears, in the Unzip to folder box, type a folder name or click Browse to select a folder, and then click Unzip.
- You should see the message 5 file(s) unzipped successfully. When you see that message, click OK. Click Close to close the extractor.
Top of Page
Register the DLL with Windows
One of the support files that you just extracted is VB6IDEMouseWheelAddin.dll. This file provides the core support needed for using the scroll wheel in VBA 6. You must register the DLL with Windows before it can be used. To do so, take these steps:
- On the taskbar, click Start, and then click Run.
- In the Open text box, type the following command, where <path> is the path specification for the folder where you unzipped the files. For example, if you unzipped the files to the C:\VBAMouseWheel folder, type regsvr32 c:\VBAMouseWheel\VB6IDEMouseWheelAddin.dll.
Note The VB6IDEMouseWheelAddin.dll file should not be moved after it has been registered. If you unzipped the support files to a temporary location, you should copy the VB6IDEMouseWheelAddin.dll file to your Windows folder and then register that copy instead.
Your Run dialog box should look something like this:
- Click OK.
If the command succeeds, you should see a message similar to the following:
Top of Page
Merge the .reg file with your system registry
Included among the files you extracted is a file with a .reg extension, VBA Mouse Wheel Fix.reg. This file contains a modification to your system registry that enables support for the scroll wheel via a VBA add-in. To merge the .reg file:
- Double-click VBA Mouse Wheel Fix.reg, which will have been unzipped to the folder you specified earlier.
- Click Yes when you you are prompted with the message Are you sure you want to add the information in <path>\VBA Mouse Wheel Fix.reg to the registry?.
- You should see a confirmation message similar to the following illustration. When you see the message, click OK.
Top of Page
Enable the VBA add-in
After you have completed the preceding steps, all that remains is to enable the VBA add-in so that it is automatically loaded whenever the Visual Basic Editor starts. You need only perform this step once, in any of the Microsoft Office System programs, to enable the scroll wheel in the IDE of all of the Microsoft Office System programs.
The following list shows the steps for the Microsoft Office System programs: Access 2003, Excel 2003, PowerPoint 2003, and Word 2003. Choose only one of these programs and perform the steps listed in the procedure.
Access 2003, Excel 2003, Word 2003, or PowerPoint 2003
- Start either Access, Excel, Word, or PowerPoint.
- Open a database (Access), workbook (Excel), document (Word), or presentation (PowerPoint).
- On the Tools menu, point to Macro, and then click Visual Basic Editor.
- When the Visual Basic Editor appears, on the Add-Ins menu, click Add-In Manager.
- In the Add-In Manager dialog, click MouseWheel Fix.
- Under Load Behavior, select both the Loaded/Unloaded and Load on Startup check boxes. Both check boxes should have a visible checkmark.
- Click OK.
- Close the program.
Top of Page
You’re done! After completing these steps, the next time you open the VBA IDE (the Visual Basic Editor), you should be able to open a module and use the mouse wheel to scroll — whether the fix actually enables this functionality depends, ultimately, on your mouse driver.
Technically speaking, the WM_MOUSEWHEEL message is sent to the window with the focus when you rotate the mouse wheel. Because the VBA 6 environment does not have built-in support for scrolling by using the mouse wheel, these messages are ignored. However, after you install the fix described here, the messages are handled by the code in the VB6IDEMouseWheelAddin.dll file.
Top of Page