Results 1 to 8 of 8
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    msgboxs (WinNT, W97)

    <img src=/S/grin.gif border=0 alt=grin width=15 height=15> Mornin'! (at least it is here, in England!)

    More curiosity than anything else - is it possible to hide and show msgboxs? Or does one have to make a userform to be able to do that with it?

    I just want to put a message on screen saying basically 'Please Wait' because some code I've written takes a few seconds to run, but I'm not sure how would be the best way to go about this ...

    Many thanks in advance for any info!
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: msgboxs (WinNT, W97)

    You need to use a userform.
    If you want your code to continue running whilst the userform is displayed then make sure it is Modeless.

    StuartR

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: msgboxs (WinNT, W97)

    Ah - now that's a term I've seen around but haven't the faintest idea what it is! <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

    What makes code 'Modeless', and what does it mean, please?
    Beryl M


  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: msgboxs (WinNT, W97)

    A UserForm can be modal or modeless.

    If it is modal then the application will pause all other processing whilst the form is displayed, resuming when the form is closed.
    If it is modeless then the application will continue other processing whilst the form is displayed.

    You choose which you want when you show the form using the syntax <font color=blue>frmName.Show vbModal</font color=blue> or <font color=blue>frmName.Show vbModeless</font color=blue>. This is described in the VBA help for the Show method of a userform, which concludes by saying...
    <pre>Note In Microsoft Office 97, if a UserForm is set to display as modeless,
    it causes a run-time error; Office 97 UserForms are always modal.

    When a UserForm is modeless, subsequent code is executed as it's
    encountered. Modeless forms do not appear in the task bar and are not
    in the window tab order.

    Note You may lose data associated with a modeless UserForm if you
    make a change to the UserForm project that causes it to recompile,
    for example, removing a code module.

    When a UserForm is modal, the user must respond before using any
    other part of the application. No subsequent code is executed until the
    UserForm is hidden or unloaded. Although other forms in the application
    are disabled when a UserForm is displayed, other applications are not.
    </pre>

    StuartR

  5. #5
    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: msgboxs (WinNT, W97)

    Beryl,
    As Stuart has said, Office97 userforms are modal. The simplest way to do what you want, I think, is to have a simple procedure that loads the userform (with your "Now processing..." type message on it) and then have your code run in the userform's Activate event, followed by an Unload Me statement.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: msgboxs (WinNT, W97)

    rory,

    You clearly know something about Beryl's environment that I don't <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    StuartR

    Edited by StuartR. I have just realised that (WinNT, W97) means Office97 on Windows nT4.

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: msgboxs (WinNT4, Word97)

    Thanks for the help, Rory and Stuart - one learns something new every day, especially here!
    And sorry <img src=/S/sorry.gif border=0 alt=sorry width=15 height=15> if I should have put my system details more clearly - I've used that text for a while now and didn't even think about it! <img src=/S/woops.gif border=0 alt=woops width=58 height=36>
    Beryl M


  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: msgboxs (WinNT4, Word97)

    To work around the lack of nonmodal userforms in Office97, someone posted instructions for using the Windows API. I haven't searched through the Lounge to see if they were here, or at the MVPs site, or in the Knowledgebase. And I never tried them myself...

Posting Permissions

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