Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Darkest Kent, UK., Kent, England
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please Wait... (Word '97 VBA)

    Is there a simple way of displaying a 'Please Wait' msg box to show the user that something is still running in the background, even though screen updating has been turned off? Any msg box commands that I can find hold up the process until user input is obtained.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Please Wait... (Word '97 VBA)

    Try a simple user form with just one text box or lable saying Please Wait, and show it at the start of your operation and unload it when finished.

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Please Wait... (Word '97 VBA)

    Much as I hate ClipIt, he works well for your application:
    <pre>Option Explicit
    Dim bln As Office.Balloon
    Dim saveOn As Boolean, saveVis As Boolean
    Sub MsgOn()
    saveOn = Assistant.On
    saveVis = Assistant.Visible
    Assistant.On = True
    Assistant.Visible = True

    Set bln = Assistant.NewBalloon
    With bln
    .Icon = msoIconAlertInfo
    .Heading = "Please wait"
    .Text = "Processing your request"
    .Button = msoButtonSetNone
    .Mode = msoModeModeless
    .Show
    End With
    End Sub
    Sub msgOff()
    bln.Close
    Set bln = Nothing
    Assistant.On = saveOn
    Assistant.Visible = saveVis
    End Sub</pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  4. #4
    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: Please Wait... (Word '97 VBA)

    Andrew's suggestion will work in Outlook 2000 (VBA 6) because it has non-modal userforms (userforms that can float while code runs, rather than requiring a user action). I don't think 97 had non-modal userforms, so people used the Windows API for this.

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Please Wait... (Word '97 VBA)

    Jeff,

    (Assume you meant Word 2000) - anyway, even though Word 97 doesn't have non-modal userforms, you can still do this: show the userform, then call all the procedures you want to have run, from the userform's code module. (I used to do this in cmdOK_Click, but for a userform that's just used as a message box, you could probably have the code in UserForm_Activate or Initialize.)
    You can have a lot of fun with this - provide status updates by having the userform or labels change color and have the messages change, or put a simulated progress bar on the userform.

    Gary

  6. #6
    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: Please Wait... (Word '97 VBA)

    Coming from the macro background rather than a VB background, I don't put a lot of code into forms. I tried it and hey, it works! This test was done in Word 2000 with a simple one-label userform running in a long document:

    <pre>Private Sub UserForm_Activate()
    With Selection
    .HomeKey wdStory, wdMove
    Do While .Start < ActiveDocument.Characters.Count - 1
    .MoveDown wdParagraph, 1, wdMove
    Me.Label1.Caption = "Page " & .Information(wdActiveEndPageNumber) & _
    " Line " & .Information(wdFirstCharacterLineNumber)
    Me.Repaint
    Loop
    End With
    Me.Hide
    End Sub</pre>

    Incidentally, before I put in the Repaint call, I just got a white box.

Posting Permissions

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