+ Reply to Thread
Results 1 to 5 of 5

Private sub textbox1_exit in a frame/not in a frame, different behavior?

  1. #1
    Registered User
    Join Date
    02-23-2015
    Location
    US
    MS-Off Ver
    2010
    Posts
    20

    Private sub textbox1_exit in a frame/not in a frame, different behavior?

    See attached Excel sheet.

    I have a userform in the attached workbook, but I removed almost all the code except the code in question to keep it simple. A nice person on the forum helped me with a problem where I didn't want the user to be able to navigate away from a textbox if the entry was out of a certain range, in this case 1 to 100. He/She gave me the following code:

    Please Login or Register  to view this content.
    The code works, but ONLY if my textbox1 is NOT in a frame. When I made textbox1, I put it and its corresponding spinbutton outside of a frame, and the code works when I hit the little play button. If I enter a number (I used 200), it won't let me click away until I enter a number 1 to 100. But when I dragged textbox1 and the corresponding spinbutton into Frame 8 just below it and ran the code, I'm able to navigate away from an invalid entry (I used 200).

    Why does it matter if textbox1 is in a frame or not? I want to use frames to organize the userform, so how do I get the code to work inside of a frame? Thoroughly confused after 2 hours of fiddling and figuring out that it was the frame causing the problem in the first place.

    Thanks for your time.
    Attached Files Attached Files
    Last edited by ualdriver; 06-14-2015 at 07:39 PM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Private sub textbox1_exit in a frame/not in a frame, different behavior?

    code works for me if frame contains textbox and spin button
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    02-23-2015
    Location
    US
    MS-Off Ver
    2010
    Posts
    20

    Re: Private sub textbox1_exit in a frame/not in a frame, different behavior?

    Quote Originally Posted by Andy Pope View Post
    code works for me if frame contains textbox and spin button
    Andy-

    I am not trying to be obtuse by any means or waste anyone's time, but I downloaded the Excel file from your post with the textbox1 and its spinbutton in the frame8, hit play, typed 300 into the textbox and I was able to click away into another textbox with that invalid number (number needs to be beween 1-100). When I dragged the textbox and spinbutton out of frame 8 and entered the number 300, it did not allow me to click away out of that textbox until I entered a number between 1-100. I tried this on two different computers.

    Thoroughly confused now that it worked for you and not me.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Private sub textbox1_exit in a frame/not in a frame, different behavior?

    I used Tab to move to move to next control.

    To stop mouse clicking to another control outside of the frame you also need to use the frame exit event

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-23-2015
    Location
    US
    MS-Off Ver
    2010
    Posts
    20

    Re: Private sub textbox1_exit in a frame/not in a frame, different behavior?

    Quote Originally Posted by Andy Pope View Post
    I used Tab to move to move to next control.

    To stop mouse clicking to another control outside of the frame you also need to use the frame exit event

    Please Login or Register  to view this content.
    Thanks very much for your time Andy. Will give it a spin tonight.
    Last edited by ualdriver; 06-15-2015 at 09:45 AM.

+ 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] Looping through controls by frame on userform (frame within a frame)
    By njs27 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2015, 10:21 AM
  2. sum 2 column contains frame where frame*24
    By eng.hussein.maher in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 06-22-2014, 04:03 PM
  3. displaying a frame that is behind/embedded with another frame
    By bhodge10 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2007, 10:23 AM
  4. Frame
    By Nick London in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-04-2006, 10:40 AM
  5. How to attach legend frame to chart frame?
    By holg3r in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-07-2005, 06:41 PM

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