Enable Mouse-Wheel Scrolling in an Excel VBA UserForm TextBox
Question details
Add mouse-wheel scrolling to a TextBox on an Excel VBA UserForm and identify where to use the form and control names in a workaround.

- Product
- Microsoft Excel VBA
- Device & OS
- not provided
- Scenario
- A user wants to scroll multiline text inside a UserForm TextBox using the mouse wheel.
- Observed behavior
- The UserForm TextBox does not natively scroll with the mouse wheel.
In the VBA editor, select the form and TextBox and check their (Name) properties in the Properties window. If you plan to use a Windows API workaround, check Excel's bitness under File > Account > About Excel and choose code compatible with it.
Add a compatible Windows API mouse-wheel handler
Use this approach when mouse-wheel scrolling is essential and you have a Windows API sample compatible with your Excel version.
The original answer refers to a Windows API workaround but does not include its code. Use a complete, trusted sample designed for UserForm TextBox scrolling; the exact installation and replacement points depend on that sample.
API hooks can destabilize Excel if installed or removed incorrectly. Follow the sample's cleanup instructions and make sure it supports your 32-bit or 64-bit Excel installation.
Search OzGrid for “VBA UserForm TextBox mouse wheel API” and select a sample that explicitly supports TextBox scrolling and your Excel bitness.
In Excel, press Alt+F11, open the UserForm, and select the form and TextBox in turn. Check each (Name) property in the Properties window; these might be UserForm1 and TextBox1.
Follow the sample's instructions for placing code in the UserForm and, if required, use Insert > Module to add its standard-module code. Do not omit its setup or cleanup procedures.
Replace the sample's form and TextBox references with your actual names where instructed. For example, a reference in the form's own code might be Me.TextBox1; a reference elsewhere might be UserForm1.TextBox1. Do not rename API declarations or procedure names unless the sample directs you to do so.
Run the UserForm from the VBA editor, place the pointer over the TextBox, and try the mouse wheel. Close the form normally so the sample's cleanup code can run.

Use the TextBox vertical scroll bar instead
Use the built-in scroll bar when mouse-wheel support is not required.
Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format compatibility for an easier move between applications. It does not fix Excel's UserForm mouse-wheel behavior or replace the Windows API workaround.

Frequently Asked Questions
Where do I find my UserForm and TextBox names?
Press Alt+F11, open the form, and select the form or TextBox. Press F4 and look for the (Name) property in the Properties window.
Does setting ScrollBars to vertical enable the mouse wheel?
No. Set MultiLine to True and ScrollBars to fmScrollBarsVertical to use the TextBox's vertical scroll bar. Mouse-wheel scrolling requires a separate workaround or suitable custom control.
Where should I replace UserForm1 in an API sample?
Replace the sample's form references where its instructions identify them. Inside the form's own code, a control may be referenced as Me.TextBox1; elsewhere, the sample may use UserForm1.TextBox1. The exact locations depend on the sample.
Can I use a Windows API sample in 64-bit Excel?
Only if the sample supports 64-bit Excel or has been correctly adapted for it. Check File > Account > About Excel for your bitness and review the sample's compatibility and cleanup instructions before running it.




