+ Reply to Thread
Results 1 to 5 of 5

Userform textbox question

  1. #1
    Forum Contributor
    Join Date
    02-07-2011
    Location
    netherlands
    MS-Off Ver
    Excel 2003
    Posts
    128

    Userform textbox question

    Is there something that when i click on a textbox in a userform a script may trigger?
    the same thing as a normal button is clicked but then as a textbox.



    or to go even further if possible.
    i want that when you double click the textbox a scripts will start to work in the userform. and when single clicked you may just write anything like it whould do normaly.

    Anyone has knowledge about this option?

    Tnxs in advance.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,013

    Re: Userform textbox question

    Yes - add a textbox to your userform, right-click it and choose View Code, then change the top right dropdown from Change to DblClick and you should get a procedure created that looks like this:
    Please Login or Register  to view this content.
    Put your code in there.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    02-07-2011
    Location
    netherlands
    MS-Off Ver
    Excel 2003
    Posts
    128

    Re: Userform textbox question

    ok thanks that was what i needed.

    but could you tell me what the ByVal cancel behind it does do? i did not seen it before and i dont get that line behind my sub

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,013

    Re: Userform textbox question

    If you set it to True in your code, it cancels the default behaviour of the control (for a textbox that would usually be selecting all the text)

  5. #5
    Forum Contributor
    Join Date
    02-07-2011
    Location
    netherlands
    MS-Off Ver
    Excel 2003
    Posts
    128

    Re: Userform textbox question

    thank you i understand now.

    i got a new problem now.

    when you are double clicking this Textbox i want a new script to run which works now.
    the idea is to load another userform over this one.

    in this 2nd userform you will be selecting a diffrent data like a company name.
    and this will be brought back to userform 1 which is the main sheet.

    it is complicated and i whould like to know wether this is possible?
    i have to less experance to know any command for this so im pleased with any suggestion i can start with.




    i am trying out the userform and learning its power and its possibilities. but im not sure which commands are all useable.

    tnxs in advance

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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