+ Reply to Thread
Results 1 to 3 of 3

Userform multipage control - exit event not firing or event order

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    21

    Userform multipage control - exit event not firing or event order

    Hi

    I need some help. I have a Multipage with 3 tabs (each tab has its own controls but they also share some command buttons with every other tab eg - save, close etc). When the user clicks a command button eg - close, I need to check if any of the data has changed on the tab before closing. I have exit events on all controls to check the data status. I need these exit events to have fired prior to the user clicking on a command button and then execute the command button code. The problem is that the command button code executes first then the control_exit event runs.

    If the user clicks another control in the tab first, then a command button, all the code executes in the correct order.

    What can I do to make this work correctly?

    Thanks

  2. #2
    Registered User
    Join Date
    04-29-2013
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Userform multipage control - exit event not firing or event order

    Hi all

    I have solved this and posted the solution so others can make use of it. Apparently this is a known VBA bug. When exiting to the multipage frame by clicking on a control external to the frame, you need to force the focus back into the frame to ensure all exit events run before the code associated with the external control runs. To do this, I added a dummy text box in the frame (not visible etc) and added code to the external control to SetFocus on the dummy text box first and then run the external control code. Example: if I were to click in a textbox1 on multipage(0) and then click the Close button, I want the exit event for textbox1 to run before the Close code

    Please Login or Register  to view this content.
    Hope this helps ...
    Last edited by arlu1201; 06-14-2013 at 10:22 AM.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Userform multipage control - exit event not firing or event order

    Jane,

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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