+ Reply to Thread
Results 1 to 20 of 20

SetFocus ActiveX TextBox ??

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    SetFocus ActiveX TextBox ??

    My project has an ActiveX textbox on Worksheet 1. I want to setfocus to this textbox when the program opens.

    This is what I've tried so far:

    #1:
    Please Login or Register  to view this content.
    #2:
    Please Login or Register  to view this content.
    #3:
    Please Login or Register  to view this content.
    I've searched the Forum and the 'Net for other suggestions ... nada.

    How do I set focus to TextBox9 ? (ActiveX control on worksheet 1)

    Thank you.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: SetFocus ActiveX TextBox ??

    Hello Logit,

    Maybe?

    Please Login or Register  to view this content.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Winon:

    Thanks for the reply.

    Tried the suggestion - it makes the textbox visible = false.

    Put this in after your suggestion:

    Please Login or Register  to view this content.
    Then I tried:

    Please Login or Register  to view this content.
    Textbox still not visible.

    Hmmm ..

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: SetFocus ActiveX TextBox ??

    Thank for the feedback Logit,

    There is absolutely no way that my code can change the Visibility of the TextBox to False.LOL

    Somewhere in the Code of the Project, there must be an instruction to do that. I find this very unusual!

    Attach a sample workbook with your complete Code.

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Would love to sort this out for you.

    Regards.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: SetFocus ActiveX TextBox ??

    O.K. Logit,

    Try this:

    Please Login or Register  to view this content.
    That should work.

    Regards.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Winon:

    File Attached.

    Before clicking the location of the textbox:

    Before Click On Textbox.jpg

    After clicking the location where textbox is:

    Afrter Click on TextBox.jpg
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: SetFocus ActiveX TextBox ??

    Not Sure why Textbox9 goes missing on you... I downloaded the file and without any adjustments to it from me it has textbox9 visible and selected as you are wanting it to do
    Bramz

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: SetFocus ActiveX TextBox ??

    Thank you Logit,

    What a COMPLICATED setup!WOW

    Anyways, please try the attached now.

    Regards.
    Attached Files Attached Files

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Winon:

    I'm not certain what is happening with my system here. The first time I opened your attachment the textbox was visible. The second time, same ole same ole.

    I do appreciate you looking at it though.

    RE: the syntax. I'm a newbie. Doing what I can. Open to any suggestions you might have.

    Thank you again.

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Winon:

    If I comment out the following in ThisWorkBook:

    Please Login or Register  to view this content.
    The textbox is visible.

    Seems like whatever is done here, re: the textbox, in the ThisWorkBook, messes things up. I've tried putting the code in a module and in the WorkSheet Activate - still nothing.

    I'm puzzled. The examples I've found in the Forum and the Net ... those folks seemed to have solved their problem. Don't know why it won't work here.

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: SetFocus ActiveX TextBox ??

    I love this challenge Logit,

    Please try the revised attachment now. Also try selecting any other Sheet, and then back to Sheet1.


    Regards.
    Attached Files Attached Files

  12. #12
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Progress.

    At least the cursor is where it should be, but the textbox remains invisible. Clicking on sheet2 then back to sheet 1 isn't a viable option (although that works).

    I've been trying different variation of Sheet Activate. No luck.

  13. #13
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Winon:

    GOT IT !

    Please Login or Register  to view this content.

  14. #14
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Now, when the CLEAR button is pressed and the textbox is empty, it needs to remain visible.

    With the cursor in the textbox, click the CLEAR button a few times to see what I mean.

  15. #15
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: SetFocus ActiveX TextBox ??

    Well done Logit,

    It is not the most elegant, or desired solution, but I am proud of you for finding a working solution, since I could not replicate your problem on my side!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    What a pleasure to have been working with you on this issue!

    Kind regards,

    W.

  16. #16
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Winon:

    Cleared up the last issue, placing this in the CommandButton_Click sub for the CLEAR button:

    Please Login or Register  to view this content.
    Thanks for your help. Always very much appreciated !

  17. #17
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: SetFocus ActiveX TextBox ??

    Sorry Logit, I missed your last "problem",

    Use the Code below for CommandButton1;

    Please Login or Register  to view this content.
    Please let me know if it works for you.

  18. #18
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,716

    Re: SetFocus ActiveX TextBox ??

    Much cleaner and yes it does work. I'll use it instead.

    Thanks !

  19. #19
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: SetFocus ActiveX TextBox ??

    You are welcome Logit,

    Glad I could help, and also thank you for adding to my Reputation, much appreciated!

    Kind regards.

  20. #20
    Registered User
    Join Date
    04-18-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1

    Re: SetFocus ActiveX TextBox ??

    ActiveSheet.Shapes.Range(Array("TextBox1")).Select
    With Selection
    .Activate
    End With

+ 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 on a Userform TextBox
    By bibu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2015, 05:18 PM
  2. [SOLVED] Unable to setfocus on my textbox
    By JPGraphX in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-18-2014, 09:54 AM
  3. Multi-Worksheet ActiveX Textbox to ActiveX Textbox Concatenate
    By HVE_Skynet in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2014, 02:11 PM
  4. VBA Setfocus to next textbox
    By pjbassdc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2013, 12:47 PM
  5. TextBox.SetFocus not working
    By vesoljc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-11-2007, 01:49 AM
  6. [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
  7. 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