Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    controlname_Exit doesn't run in frame (Excel97/NT)

    Hi

    I'm getting the feeling that someone's ganging up on me, today.

    A particular textbox on my UserForm ("DOA") has an exit procedure ("DOA_Exit"). When I tab out of the field, DOA_Exit runs (as expected).

    I decided to move some of the controls (including this textbox) into a frame. Now when I tab out of that same field, DOA_Exit doesn't run. (The insertion disappears, but I can't tell where it goes to.)

    If I drag the control out of the frame, and rerun, it works again.

    Any ideas?
    Dale

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: controlname_Exit doesn't run in frame (Excel97/NT)

    Could you remove a stripped down version of the workbook? Remove anything from the workbook that is not needed to see the problem, and remove or change sensitive data. Zip the file if necessary to get it below the 100 KB for attachments.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: controlname_Exit doesn't run in frame (Excel97/NT)

    Hi Hans

    Demo attached. I actually constructed it from scratch. Looks to me like it's a VBA bug?

    Thanks for your help
    Dale

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: controlname_Exit doesn't run in frame (Excel97/NT)

    Yes, this is a bug - see MSKB article OFF2000: Exit Event for TextBox in a Frame Does Not Run Correctly. The problem still exists in at least Office 2000 and XP.

    Apparently, the On Exit event works at the frame level - if you put another text box within the frame, moving the focus from TextBox2 to the new text box does cause the On Exit event to occur. Moreover, moving the focus from TextBox2 to TextBox1 causes the On Exit event for Frame1 to occur.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    378
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: controlname_Exit doesn't run in frame (Excel97/NT)

    Thanks, Hans

    I tried putting a second textbox in the same frame (hidden where the user wouldn't see it), and modifying the code to pass the focus to the "invisible" textbox and back again, but it got too complicated (what with clicking and tabbing, and events). Also, the device of passing the focus to and from doesn't always seem to work.

    My best effort is attached. It works if you tab repeatedly, or press Enter repeatedly. But TextBox2_Exit doesn't execute if you click TextBox1.

    Too hard, I think. I might try to mimic a frame with a graphic.

    Thanks for your help, Hans
    Dale

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: controlname_Exit doesn't run in frame (Excel97/NT)

    Avoiding frames - if your design allows that - is probably the way to go.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •