Results 1 to 5 of 5
  1. #1
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Message box whilst vba running (2003)

    Hi,
    I have some vba code that can take a minute or two to run. Screen updating is set to false, so you only see the screen / mouse flicker. To the end user, it may seem that the pc is playing up / crashing. The code starts with a message box and ends with an info box. I would like to add another info box (before screen updating is set to false) and that automatically disappears prior to the end info box that states (something like) updating, please wait. Is this possible?

    Probably beyond the realms of vba, but maybe a 'progress bar' that shows updating???

    Thanks
    Nathan

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Message box whilst vba running (2003)

    You can pop up a userform with a message and have it run your main code, but I'd be intrigued to see the code to see what causes the flickering when you have turned off screen updating.
    Regards,
    Rory

    Microsoft MVP - Excel

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

    Re: Message box whilst vba running (2003)

    You can't use MsgBox for this, for code execution is suspended while a MsgBox is displayed.

    You could create a userform whose ShowModal property is set to False.
    The userform could contain a label with a caption such as "Please wait until the macro has finished."

    You could select Tools | More Controls... (in the Visual Basic Editor) to add the Microsoft ProgressBar Control 6.0 (SP6) to the ToolBox. You can then add a ProgressBar to the userform. You'll have to use code to update it while the macro executes, which means that you'll have to have a good idea of how far your macro has progressed at each stage.

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

    Re: Message box whilst vba running (2003)

    Oh, I forgot to post a link to reference info about the ProgressBar control. Here it is: ProgressBar Control.

  5. #5
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message box whilst vba running (2003)

    Thankyou both....
    We are stepping into totally unknown territory here! I have never needed to use and therefore have no knowledge of 'userforms'. Sounds like a fair bit of work, but I am intrigued, so will revisit this once I have done a little research.

    Rory: I will try and zip a file and post tomorrow.

    Thanks again
    Nathan

Posting Permissions

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