Results 1 to 10 of 10
  1. #1
    Lounger
    Join Date
    Aug 2003
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Progress Bar (word 2000, word 97)

    I want to do a much simpler version of the "Userforms" Post. When the user clicks the Ok button, I want to display a Message " Please Wait.... " on the screen until processing is done. I tried creating another userform(userform2) and displaying that message, but unfortunately i had to close the userform2 for processing to continue which defeats the purpose <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15> ...

    Please help...
    Thanks....

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

    Re: Progress Bar (word 2000, word 97)

    I think I am repeating myself. You will have to run the code you want to perform from UserForm2 (the Please Wait form), not from the form containing the OK button.

  3. #3
    Lounger
    Join Date
    Aug 2003
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Progress Bar (word 2000, word 97)

    Ok, i do have the code in the UserForm2 (main function ) just like in the example you posted. At runtime, the UserForm2 looks like it is loaded, but it does not diaplay anything on the USerform(i had a label on it), instead it shows a WHite backgorund. Between the display of the UserForm2 and unloading the same, i am updating another document. What am i doing wrong?

    Thanks...

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

    Re: Progress Bar (word 2000, word 97)

    You can force the form to display properly by inserting

    Me.Repaint

    before starting the code that updates the document. Otherwise, VBA is so busy processing the document that it doesn't get round to drawing the form.

  5. #5
    Lounger
    Join Date
    Aug 2003
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Progress Bar (word 2000, word 97)

    Tried that. But it repaints it for a moment and then control goes back to the other document and i get a white background <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15> <img src=/S/cooked.gif border=0 alt=cooked width=50 height=46>

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

    Re: Progress Bar (word 2000, word 97)

    If you have some kind of loop in the code that processes the document, insert a DoEvents instruction or an Me.Repaint instruction somewhere in the loop. See if that helps.

  7. #7
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Progress Bar (word 2000, word 97)

    Hi su1234,

    If you really want something much simpler, you could just place your progress message on the status bar. If you're interested in this approach, try the following:

    1 Prefix your existing code with:
    Dim SBar As Integer
    This stores the current state of the status bar so that it can be restored after your code has finished.

    2 Call the following MacroEntry and MacroExit subs from the first and last lines of your macro, both for feedback and maximum execution speed:
    Sub MacroEntry()
    SBar = Application.DisplayStatusBar
    Application.DisplayStatusBar = True
    Application.ScreenUpdating = False
    End Sub

    Sub MacroExit()
    Application.StatusBar = False
    Application.DisplayStatusBar = SBar
    Application.ScreenUpdating = True
    End Sub

    3 In the body of your macro, where all the work's being done, insert lines like:
    Dim CurrentCount as Integer, TotalCount as Integer
    CurrentCount = CurrentCount +1
    and
    Application.StatusBar = Int(CurrentCount / TotalCount * 100) & "% Complete"
    or
    Application.StatusBar = "Processing Record " & CurrentCount
    where "CurrentCount" and "TotalCount" are the names of the counter that keeps track of where your macro's up to and the number representing whatever the counter will be at once you reach 100%, respectively. The second form is more useful when you don
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #8
    Lounger
    Join Date
    Aug 2003
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Progress Bar (word 2000, word 97)

    tried that but still it only repaints for the moment i call it and then goes back to the same old White background...

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

    Re: Progress Bar (word 2000, word 97)

    You'll either have to repaint the form much more often (this will affect the performance of the code neagatively), or use the much simpler StatusBar approach suggested by macropod - no userform involved.

  10. #10
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Progress Bar (word 2000, word 97)

    I have no idea of whether this will help you, but the akProgressBar is a <img src=/S/free.gif border=0 alt=free width=30 height=15> progress bar control for VB6. It may be of use from within VBA.

    Alan

Posting Permissions

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