Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004

    Unanswered: Prevent leaving Excel window while code runs

    (Excel 2007, SP2, Vista)
    I have a few processes that take 5-15 seconds to complete. I want to keep the user from leaving the Excel app. window and minimizing the window while the code runs. Currently, if the user does either, the code may fail OR I can't return to the Excel window after leaving (the Excel box at bottom of screen just blinks Orange, indicating it's waiting for a responses/action, but I can't get focus back to the window to take any action so I have to END TASK to close Excel!)

    I do have a form showing status updates and turn off screen updates so the user knows something is happening during the wait time, but I really just need to ensure that the user waits at the Excel application window until the VBA/process completes to ensure there aren't any code/focus issues. (Again, it's only 5-15 seconds -- not that long.)

    Does anyone know either how to do this OR a good way to prevent the orange flashing button/locking problem I described above?

    Thanks in advance.

  2. #2
    Join Date
    Oct 2002
    Baghdad, Iraq
    I think you're looking for Application.Interactive.

    At the bottom of that page, you'll also see the ScreenUpdating property.

    If you *really* need to be sure the user doesn't mess with it, it's possible to launch another instance of Excel in the background, completely hidden. That takes a little doing, but it works for big jobs.

Posting Permissions

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