+ Reply to Thread
Results 1 to 1 of 1

Highlight a ComboBox or TextBox in a Userform

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    Rio, Brazil
    MS-Off Ver
    Excel 2003
    Posts
    11

    Highlight a ComboBox or TextBox in a Userform

    Sometimes it is useful to highlight a selected item in a combo box or a text box for easy text replacing.

    First of all, as many developers know, when you want to get into a form changing the active control and highlighting it, you simply can write:

    Please Login or Register  to view this content.
    However, inside a userform edition, when you click in a text box control, the content does not get highlighted. On the other hand, if you get into the control using tabs, the current content it is highlighted by default.

    The solution for click event is not use the Enter event, but the MouseDown event:


    Please Login or Register  to view this content.
    It works for Combo Boxes and Text Boxes.

    Most believe that Enter event would work on that situation, but it doesn't, because the Enter event change the active control for the destination but not completely. It runs before MouseDown event, therefore before the mouse click action and its consequences.

    Besides, I have not found any reference that the above trick works well also for combo boxes. It is cool because a user can type just the initials for fast selection, without manually erase the current item.

    Version: Excel 2003 to Excel 2010
    Last edited by Paulo Buchsbaum; 11-16-2012 at 02:25 PM. Reason: Combo demands use Text property that is not default property. Text

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1