+ Reply to Thread
Results 1 to 10 of 10

cursor is not staying in textbox

  1. #1
    Forum Contributor
    Join Date
    10-22-2012
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    159

    cursor is not staying in textbox

    Hi all,

    I have user form with 2 text boxes. i want to type some line like "I am very happy" in that text box.
    I typed "I am" then i pressed Alt + Tab then again i pressed ALT + Tab. i need to type "very happy" now. but cursor is not staying in that text box. again i need to click in that text box with mouse then i need to type.

    When i came back to userform that cursor should be there and i can able to type in that text box. how can i do this? is there any vba code for this.
    Regards,
    PRB.

    Right time to become Expert..

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: cursor is not staying in textbox

    Hello punna111,

    In case you didn't know, there are 3 types of TextBoxes: Forms, ActiveX, and Drawing. each has its own properties. You need to identify which type you are referring to.

    If you are not sure then post your workbook.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    10-22-2012
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    159

    Re: cursor is not staying in textbox

    Hi Leith Ross,

    Thank you for reply.

    please find the attached excel file. try by doing switch windows. cursor is not blinking in textbox. actually it is combo box. it is a example file. please click on a button on sheet1 to see the userform1.
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: cursor is not staying in textbox

    Hello punna111,

    Can you explain why the example file does not match with the description in your first post?

    Problems Found
    1. A ComboBox can not be used like a TextBox.
    2. There is no code written for the ComboBox.
    3. There are no TextBoxes on the UserForm.

    Your results will be only as good as the information you provide.

  5. #5
    Forum Contributor
    Join Date
    10-22-2012
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    159

    Re: cursor is not staying in textbox

    Hi Leith Ross,

    Glad to see your answer.

    For 3 problems my answer is:
    1) I am unable to paste in a text box from clipboard. but i can paste in combo box that's why i used combo box as text box.
    2) I already mentioned in the 2nd post this is a demo file.
    3) If the code will only work with text boxes not with the combo boxes, please find the attachment with text box.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-10-2013
    Location
    Flintshire, Wales
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: cursor is not staying in textbox

    Try the following for sheet1:
    In the code for commandbutton1 alter to this,
    Please Login or Register  to view this content.
    in the code for userform1 alter to this,
    Please Login or Register  to view this content.
    I did not have a problem pasting text into the textbox.

  7. #7
    Forum Contributor
    Join Date
    10-22-2012
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    159

    Re: cursor is not staying in textbox

    Thank you IGEDIT,


    I am able to paste in Text box. but cursor is not staying in textbox when i use alt+tab to switch windows.
    is there any code for this?

  8. #8
    Registered User
    Join Date
    04-10-2013
    Location
    Flintshire, Wales
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: cursor is not staying in textbox

    Will look into that.
    Try this in userform1 code.
    Please Login or Register  to view this content.
    Last edited by IGEDIT; 04-29-2013 at 10:21 AM. Reason: Added code.

  9. #9
    Forum Contributor
    Join Date
    10-22-2012
    Location
    hyd
    MS-Off Ver
    2010
    Posts
    159

    Re: cursor is not staying in textbox

    Thank you for your reply,

    I am sorry to say, the above code is not working.

  10. #10
    Registered User
    Join Date
    04-10-2013
    Location
    Flintshire, Wales
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: cursor is not staying in textbox

    The attached file works for me!cursor not.xlsm

+ 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