+ Reply to Thread
Results 1 to 6 of 6

UserForm or MsgBox without code interruption?

  1. #1
    Registered User
    Join Date
    09-20-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    43

    UserForm or MsgBox without code interruption?

    I have a few functions in my workbook that get called every few minutes by the On.Time event in the background while users are working. Occassionally it needs to report something to the user but I want to do this in such as way that the code continues executing even while the message is displayed. This is because the workbook may be left unattaended but I need the On.Time event to continue to run every n minutes.

    Application.StatusBar is not going to be noticeable enough. Is there any way to pop up a message or UserForm part way through these background procedures and have the code continue to run (and even get called again) despite the message showing on screen? I know a message box won't work so didn't even try it. I tried a userform but as soon as it's displayed the code stops until the userform is closed.

    I'm thinking I need to call some windows function outside excel but I don't know how to do that. If anyone has a code example that would be great.
    Last edited by Riggers; 09-20-2011 at 03:24 AM.

  2. #2
    Registered User
    Join Date
    09-20-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: UserForm or MsgBox without code interruption?

    OK so I search the internet for an hour then give up and register and post here. Then within 2 minutes of posting I come across the answer myself

    I just learned about Modeless User Forms. Apparently when these are displayed the user can continue accessing the workbook and code continues to run.

    UserForm.Show 'Modal is not specified so the default is true
    UserForm.Show(False) 'Sets the user form to modeless and it works!

    Thankyou me for answering my own question

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: UserForm or MsgBox without code interruption?

    Your post does not comply with Rule 9 of our Forum RULES. If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit. And please never edit a thread in which someone else has responded.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    09-20-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: UserForm or MsgBox without code interruption?

    Quote Originally Posted by royUK View Post
    Your post does not comply with Rule 9 of our Forum RULES. If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit. And please never edit a thread in which someone else has responded.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Well thank you very much for that royUK. I guess thats the way you welcome people on their first post in the forum - by giving them a slap!

    For your information I DID try and assist other members by posting details of the solution. I will now mark it solved.

    Giving people a slap via a standard 'you broke the rules' message is not a very friendly way to welcome them to your forum.

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: UserForm or MsgBox without code interruption?

    delete 8910
    Last edited by mikerickson; 09-20-2011 at 03:50 AM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: UserForm or MsgBox without code interruption?

    I don't see what's unreasonable in being asked to mark a thread solved and if required post the solution. The reminder wouldn't have been necessary if you had actually read the Forum Rules

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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