+ Reply to Thread
Results 1 to 11 of 11

TextBox Control on a Userfrom

  1. #1
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    54

    TextBox Control on a Userfrom

    I am attempting to walk a user through a userform by controling how the data entry. When the Userform is first activated the user is allowed to enter information in a textbox - once the information is entered the next textbox is enabled - the label highlighted - and I attempt to put the cursor in that textbox with the Setfocus property.

    When I step through the code - the cursor does go to the proper textbox but then vanishes immediately. See my code below.

    Can someone help me with what I am not doing correctly? Thanks.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: TextBox Control on a Userfrom

    I tried your code on a test workbook and it worked just fine for me. The cursor stayed in TextBox3 for at least a min or two. I'm using Excel 2010 but I doubt that would matter.

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: TextBox Control on a Userfrom

    Jeff,

    Are you stepping through the code with F8? Perhaps try testing the code by simply filling out the userform.

    What I'm afraid is you're seeing the textbox lose focus when you press F8. The focus will actually be on the VBE.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  4. #4
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: TextBox Control on a Userfrom

    Still does not work for me - if I go back to Textbox 2 and re-enter the data and hit enter it then works - but the first time I enter data and hit enter, the cursor flashes in textbox 3 and then vanishes - any thoughts on this?

  5. #5
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: TextBox Control on a Userfrom

    I am not stepping through when this happens. I am also wondering if, for some reason, using the "afterupdate" is the culpret...

  6. #6
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: TextBox Control on a Userfrom

    Here is the file - if that helps. Would really like to figure this problem out because it is driving me crazy.

    Thanks
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: TextBox Control on a Userfrom

    Doing some more testing -when the userform is activated I am disabling all the controls except for the first one. When the user enters data in the first textbox - I am enabling the second one and so on. When I remove the disabling and enabling feature the set focus works properly - so the error is connected to this somehow...

  8. #8
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: TextBox Control on a Userfrom

    Is there a standard format for what is to me input to the textbox?

  9. #9
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: TextBox Control on a Userfrom

    Generally speaking it is just text and numbers depending on the prompot.

  10. #10
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: TextBox Control on a Userfrom

    Is it a fixed length? I'm trying to find another way to determine when you're done with the first text box. Like:
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    06-04-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: TextBox Control on a Userfrom

    Well - did not get it figured out today - so I needed to find a way around it. I was able to change the "enabled" property to "locked" and get the desired effect - I also believe there are problems moving from between Frames so I got rid of those.

    Thanks for your help.

    Jeff

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Aplly a autofilter on a userfrom spreedsheet based on a textbox value
    By cyclone77 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-10-2012, 08:46 PM
  2. Save user input in a userfrom control
    By ccpsc in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2012, 07:22 PM
  3. Help Pre-Populating userfrom into unknown textbox
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-01-2012, 03:34 AM
  4. Regarding TextBox Control
    By skonduru in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-29-2010, 09:33 AM
  5. Textbox control
    By bhodge10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2007, 12:11 AM

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