+ Reply to Thread
Results 1 to 5 of 5

cant keep typing in userform textbox after change event

  1. #1
    Forum Contributor
    Join Date
    08-12-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    163

    cant keep typing in userform textbox after change event

    I have a userform that i have set the showmodal property to false.
    this form has a list box that is populated with a huge list of items. I have a textbox in the userform that i use as a filter. so as the user types in something it filters the results in the listbox.

    this was working fine but i added to the code to put a tooltip in when hovering over a item in the listbox. (using windows API to achieve)

    The problem now is after i type one letter in the text box and it runs the change event it doesnt place the cursor at the end of the textbox anymore to continue typing.
    I have tried setting focus to the textbox at the end of the event but nothing happens. I have searched all over the internet with no luck.

    any ideas??

    thanks
    JD

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: cant keep typing in userform textbox after change event

    me.textbox1.selstart=len(me.textbox1.text)
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Contributor
    Join Date
    08-12-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: cant keep typing in userform textbox after change event

    nathansav thanks for you reply but
    that didn't work it moved the whole userform to the left a little but i still need to click in the textbox.
    I did turn the showmodal property back to True and it worked. But i need that to be false as it interacts with the worksheet allowing the user to select cells.

    Any ideas?

  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: cant keep typing in userform textbox after change event

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.
    If posting code please use code tags, see here.

  5. #5
    Forum Contributor
    Join Date
    08-12-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: cant keep typing in userform textbox after change event

    okay,
    there is alot of stuff going on in this file. I had to delete alot of stuff to get the file size down to upload. the worksheet labeled General Summary is the sheet you need to go to. Hitting the Insert Pay Items button will bring up Userform2 it is running the InsertPayItems() sub in the standard module labeled InsertPayItems. which is the userform im asking about. there are two text boxes that run a change event. one has a label next to it saying search item number: (textbox named txtItemCode) and the other has a label saying Search Description (textbox named txtDesc)
    as you type in any of these two textboxes it will run the change event and filter the data in the listbox.
    in the change event i need to distroy the tooltips and then remake them due to the list box changing.

    I think it might be a bug or something because after typing in the textbox and it runs through the code i can hit the backspace button and it will delete what i had type, i just cant type anything.

    any help would be awesome i might just have to remove the tooltips because it was working great before i added that.
    tooltipexample.xlsm

+ 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] Detecting a PASTE event related to a UserForm TextBox.
    By Max_Taylor in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-25-2014, 05:25 PM
  2. TextBox Change Event HELP
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-13-2013, 10:16 AM
  3. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  4. Userform Textbox Exit Event to Run Application
    By baisty182 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-29-2010, 12:30 PM
  5. Userform textbox event that fires after I exit the textbox
    By jerseyguy1996 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-04-2010, 08:08 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