+ Reply to Thread
Results 1 to 8 of 8

Activating a UserForm TextBox

  1. #1
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    Activating a UserForm TextBox

    I have a UserForm that includes a TextBox.
    When I type characters inside this TextBox, a macro is called that triggers a search for the chain entered so far.
    But each time I must begin by clicking inside theTextBox before I can type in it.
    Could I include in a macro some code that will perform that clicking and leave the TextBox ready to be typed in?

    Thanks for any help.
    ACA
    Last edited by aca; 07-26-2011 at 01:20 PM.

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Activating a UserForm TextBox

    hi aca,
    try this n see if it helps
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  3. #3
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    Re: Activating a UserForm TextBox

    Thanks, John55. The line you suggest does change something, but it doesn't activate or select my TextBox.
    As it is now, my macro ends by selecting one particular cell (which is ready to be typed in).
    With the code you suggest that cell becomes inactive (cannot be typed in),
    and my UserForm gets a new color shadow; yes, but it does not become selected. to be typed in, which is what I need. What I type doestn't get entered anywhere.
    I sense, though, that you are close to the solution; one more try perhaps?
    ACA

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Activating a UserForm TextBox

    hi aca,
    that line of code works for me, it focuses textbox1.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    Re: Activating a UserForm TextBox

    Thanks again. Yes, I see yours does work all right. But mine still doesn’t.
    If you would be so kind as to have a look at the attached sample…

    That is the shell of only the relevant sheet of my workbook (a book-keeping program of sorts -in Spanish).
    My UserForm appears on opening the file (code for Workbook).
    I’ve stripped my workbook of all its macros and of the code for each worksheet as well as of the code for all the buttons inside the UserForm except the TextBox.
    In the code window of Excel you can see how I tried to apply your suggestion (code for the TextBox).
    Perhaps you will find where I am at fault. Thanks for your ongoing help.
    ACA
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Activating a UserForm TextBox

    hi aca,
    as i see the name of yr textbox is Busc, see if it helps u
    Please Login or Register  to view this content.
    Last edited by john55; 07-25-2011 at 03:56 PM.

  7. #7
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    241

    Re: Activating a UserForm TextBox

    Right! That works perfectly.
    I feel most grateful for your perseverant toturing (as I say in adding to your reputation).
    Thanks again.
    ACA

  8. #8
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Activating a UserForm TextBox

    glad to help u! thx for rep!

    If you are satisfied then please mark your thread as asolved as follows:
    Click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
    Last edited by john55; 07-25-2011 at 04:12 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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