+ Reply to Thread
Results 1 to 14 of 14

Unable to setfocus on my textbox

  1. #1
    Registered User
    Join Date
    08-06-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    91

    Unable to setfocus on my textbox

    Hi,

    I would like to get help on my issue.

    I can't setfocus on my textbox after initialize. I don't know why.. Please take a look at my excel file..

    Here is my code ..

    Please Login or Register  to view this content.
    Inspection report.xlsm

    Thanks,
    JP

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Unable to setfocus on my textbox

    You don't have a textbox qty1 in the userform1.

    When in the userform module hit Ctrl & f,
    find qty1

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to setfocus on my textbox

    Which of the 11 userforms are you having the problem with?
    If posting code please use code tags, see here.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to setfocus on my textbox

    Oops, just saw the reference to UserForm1.

    Is it qty1 on the first page of the multi page you want focus on when the userform opens?

  5. #5
    Registered User
    Join Date
    08-06-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Unable to setfocus on my textbox

    It's on userform1 initialize.

    acbebc.jpg
    Attached Images Attached Images
    Last edited by JPGraphX; 11-17-2014 at 06:03 PM.

  6. #6
    Registered User
    Join Date
    08-06-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Unable to setfocus on my textbox

    I want to focus on qty1 when my userform opens. qty1 is on multipage 1 (not 0).

  7. #7
    Registered User
    Join Date
    08-06-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Unable to setfocus on my textbox

    Any idea? (UP)

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to setfocus on my textbox

    Have you tried just selecting the 2nd tab?
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-06-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Unable to setfocus on my textbox

    What do you mean?

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to setfocus on my textbox

    You have the TabIndex of the textbox you want to have focus set to 0.

    That means that when the 2nd page of the multipage is activated that control will automatically have focus, you don't need any code to set focus on it.

  11. #11
    Registered User
    Join Date
    08-06-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Unable to setfocus on my textbox

    Yes you are right. If I load my Userform1 and then click on multipage1 and after multipage2 my focus is at my textbox qty1. How to reproduce this ?

    This doesn't work:
    Please Login or Register  to view this content.

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to setfocus on my textbox

    Try the code I posted in post #8.

  13. #13
    Registered User
    Join Date
    08-06-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Unable to setfocus on my textbox

    Oh really, no need to show!

  14. #14
    Registered User
    Join Date
    08-06-2012
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Unable to setfocus on my textbox

    SOLVED! Thanks !!

+ 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. [SOLVED] SetFocus not working on TextBox after AfterUpdate
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 06-26-2022, 07:15 PM
  2. VBA Setfocus to next textbox
    By pjbassdc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2013, 12:47 PM
  3. TextBox.SetFocus not working
    By vesoljc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-11-2007, 01:49 AM
  4. [SOLVED] Having problems with textbox setfocus
    By Terry K in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2006, 09:30 AM
  5. [SOLVED] setfocus in textbox on multipage
    By Martin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-06-2006, 12:25 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