Consulting

Results 1 to 4 of 4

Thread: Solved: Progress Indicator Form

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    Solved: Progress Indicator Form

    I am trying to use a UserForm to give the user a visual indicator that the macro is running but that it has a lot to do.

    I use pctDone (dim as single) = counter/totalrows

    Then userform.Show
    With Userform
    .frameProgress.Caption = Format (pctDone,"0%")
    .labelProgress.Width = pctDone * . frameProgress.Width
    End With

    DoEvents

    When I run the macro the UserForm appears but freezes. If I click the cross at the top right of the UserForm it does update but I cannot sit there and click it 2,000 times. Everything else is working fine as I did a Debug.Print on the pctDone and I can see the numbers running though to 1.

    Is there a way to make VBA do the same as clicking on that cross/check at the top right of the UserForm

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Put
    [VBA]UserForm1.Repaint[/VBA]
    in your loop.

  3. #3
    VBAX Regular HaHoBe's Avatar
    Joined
    Aug 2004
    Location
    Hamburg
    Posts
    89
    Location
    Hi, philfer,

    maybe have a look at Andy Pope?s Progress Meters or explain where you get the value for pctDone (maybe not a public value).

    Ciao,
    Holger

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    With progress meters, it is simpler to control the code from within the form. That is show the form, then run the real action code, updataing the form as you go along.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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