Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 6 of 6

Thread: Set Focus To TextBox on UserForm

  1. #1
    tsrwebman Guest

    Set Focus To TextBox on UserForm

    I have posted a copy of my SS athttp://www.telfordsteamrailway.co.uk...cker_weekh.xls

    On the summary page click on 'Enter Sale' and notice that Customer Advisor' text box gets the focus and the cursor is flashing. (Which is what I want).
    Enter any name and a sale value (say 'A' and '1') and click the 'OK' button
    But when I tried to enter another sale the OK button still had the focus.

    So in the VBA Project / Forms / frm_sale / OK Click event - near the bottom
    I added a set focus before the 'frm_sale.hide' - This removed the focus from the 'OK' box - but the cursor is still not in the text box, and it needs to be clicked in order to enter text.

    This is clearly something trivial I am missing - but the blinkers are on and I cant spot it

    Help appreciated.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,717

    Re: Set Focus

    POOR THREAD TITLE Please read THIS PAGE IN FULL

    VB:
    TextBox1.SetFocus 
    
    
    Last edited by Dave Hawley; October 16th, 2006 at 19:17.

  3. #3
    tsrwebman Guest

    Re: Set Focus To TextBox on UserForm

    Re title - understood, better more fully descriptive next time

    But

    textbox.setfocus doesnt work - see posted code

    Allan

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,717

  5. #5
    Join Date
    7th March 2003
    Location
    Essex, England
    Posts
    11,310

    Re: Set Focus To TextBox on UserForm

    Move the ca_name.Setfocus from the end of the Ok_Button event to the Userform Activate event
    VB:
     'clear form
    Call clear_button_Click 
     
     'aaaarggggh
     
     ''    ca_name.SetFocus
    frm_sale.Hide 
    
    
    VB:
    Private Sub UserForm_Activate() 
         
        ca_name.SetFocus 
         
    End Sub 
    
    

    Cheers
    Andy


  6. #6
    tsrwebman Guest

    Re: Set Focus To TextBox on UserForm

    cheers Andy - that got it

    Allan

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Set Focus To TextBox On UserForm Initialize
    By Mentor in forum EXCEL HELP
    Replies: 2
    Last Post: March 8th, 2008, 03:25
  2. Force Focus On Textbox
    By Obelix in forum EXCEL HELP
    Replies: 9
    Last Post: January 16th, 2008, 11:08
  3. Return Focus To TextBox
    By dunc1234 in forum EXCEL HELP
    Replies: 3
    Last Post: December 18th, 2007, 01:07
  4. Set Focus of Cursor in TextBox On UserForm Show
    By akphidelt in forum EXCEL HELP
    Replies: 4
    Last Post: May 18th, 2007, 17:01
  5. Vba Syntax: Textbox Focus?
    By eric_r in forum EXCEL HELP
    Replies: 8
    Last Post: March 15th, 2007, 06:05

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
  •  
porno