PDA

View Full Version : Solved: Progress Indicator Form



philfer
12-31-2007, 12:43 PM
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

mikerickson
12-31-2007, 05:24 PM
Put
UserForm1.Repaint
in your loop.

HaHoBe
01-01-2008, 02:26 AM
Hi, philfer,

maybe have a look at Andy Pope?s Progress Meters (http://www.andypope.info/vba/pmeter.htm) or explain where you get the value for pctDone (maybe not a public value).

Ciao,
Holger

Bob Phillips
01-01-2008, 07:57 AM
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.