• Message box whilst vba running (2003)

    • This topic has 4 replies, 3 voices, and was last updated 17 years ago.
    Author
    Topic
    #450458

    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

    Viewing 2 reply threads
    Author
    Replies
    • #1106672

      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.

    • #1106673

      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.

      • #1106676

        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

    • #1106674

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

    Viewing 2 reply threads
    Reply To: Message box whilst vba running (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: