VBA & Macro Problems

Enable Mouse-Wheel Scrolling in an Excel VBA UserForm TextBox

Nimra MalikNimra Malik Nov 20, 2026 868 views

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.

How to Scroll an Excel VBA UserForm TextBox with the Mouse Wheel
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.
Before you start

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.

Solution 1Recommended

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.

1
Find a complete sample

Search OzGrid for “VBA UserForm TextBox mouse wheel API” and select a sample that explicitly supports TextBox scrolling and your Excel bitness.

2
Identify the form and control

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.

3
Install the sample code

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.

4
Update object references

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.

5
Test and close the form

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.

Add a compatible Windows API mouse-wheel handler
Platform limitation: A Windows API solution is Windows-specific. A sample written for 32-bit Excel may require changes before it can run in 64-bit Excel.
Free Microsoft Office alternative

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.

Open and edit spreadsheets in a familiar interfaceWork with Microsoft Excel formats such as XLSX and XLSReview and manage spreadsheet data without relying on a UserForm mouse-wheel workaroundUse a lightweight office suite with a free option
microsoft office alternative - wps office

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.