How to Hide the Blinking Cursor in an Excel VBA TextBox
Question details
The user needs to hide the blinking cursor (caret) in an Excel VBA UserForm TextBox while keeping the text selectable and copyable.

- Product
- Excel VBA
- Device & OS
- not provided
- Scenario
- Creating a UserForm with a read-only text field where users can still highlight and copy the content to their clipboard.
- Observed behavior
- Disabling the TextBox removes the cursor but completely prevents text selection. Using a Label removes the cursor but does not natively support text copying. There is no built-in property to simply hide the cursor in an active TextBox.
Understand that Excel VBA does not natively support hiding the text cursor in an active, selectable TextBox control. You will need to implement a workaround that best fits your user interface needs.
Workaround 1: Use a Label with a Dedicated Copy Button
Since a TextBox cannot hide the cursor while remaining interactive, you can use a Label to display the text seamlessly and provide a button for users to copy the content.
This is the most reliable method for creating a clean, cursor-free interface in a VBA UserForm while ensuring users can still extract the information they need.
In your VBA UserForm designer, remove the TextBox and insert a Label control. Set its 'Caption' property to the text you want to display.
Insert a CommandButton next to or below the Label. Change its 'Caption' property to 'Copy Text'.
Double-click the CommandButton to open the code editor. Use a DataObject to copy the text. Example code: Dim objData As New MSForms.DataObject objData.SetText Label1.Caption objData.PutInClipboard

Workaround 2: Auto-Shift Focus Away from TextBox
Keep the TextBox so text can be highlighted, but force the form focus to a hidden control immediately so the cursor doesn't sit inside the TextBox blinking.
Try WPS Office for Seamless Spreadsheet and Macro Management
While Excel VBA has certain UI limitations with UserForms, WPS Office provides a lightweight, highly compatible alternative for handling complex spreadsheets and macros. Enjoy familiar tools with robust VBA support without the hefty subscription fees.
- 1. Download and Install WPS Office: Visit the official WPS website and download the free installation package for your operating system.
- 2. Open Your Macro-Enabled Spreadsheet: Launch WPS Spreadsheets and open your existing .xlsm or .xlsb files without losing any formatting or code.
- 3. Access the Developer Tools: Navigate to the Developer tab to open the VBA Editor, modify your UserForms, and execute your macros seamlessly.

Frequently Asked Questions
Can I use Windows API calls to hide the cursor in an Excel UserForm TextBox?
Yes, advanced users sometimes use the 'HideCaret' Windows API function. However, this method is highly complex, prone to breaking across different Windows or Office versions (especially 32-bit vs 64-bit), and is generally not recommended for standard UserForms.
Why does setting the 'Locked' property to True not hide the cursor?
The 'Locked' property only prevents the user from typing or modifying the text. It does not prevent the control from receiving focus, which is why the blinking cursor (caret) still appears when the text box is clicked.
Can I disable the TextBox but still allow text copying?
No. Setting the 'Enabled' property of a TextBox to False completely prevents user interaction. Users cannot click, highlight, or copy the text inside a disabled control.




