Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Progress Bar

Status
Not open for further replies.

chrisaroundtown

Technical User
Jan 9, 2003
122
AU
I have a progress bar on a form which I show at the start of my code, I have set it to update the progress bar value at the end of my loop. The problem is that the bar isn't actually updating as I have turned screen updating off. Is there anyway to have only the progress bar updating without the rest of the screen updating? Is there a better way to do this?

Here is what I have,


ProgressForm.Hhow
Application.ScreenUpdating = False

For i = 1 to 100
' a whole bunch of things happens here
ProgressFRM.ProgressBar1.Value = i
Next i

ProgressForm.Hide
Application.ScreenUpdating = True
 
If you implement your progress bar along the lines indicated in
the state of Application.ScreenUpdating shouldn't matter.

In your code snippet, though, I don't see anything to turn 'i' into a percentage for displaying on the progress bar. As it is, your 'i' looks to be an integer.

Cheers
 
Hi,
the ScreenUpdating property locks only spreadsheet part of screen, so progress bar is updated in both settings.
If the progress bar is on a separated form, the userform should be shown modeless:

ProgressFRM.Show vbModeless

At the end of task it is better to unload the form, otherwise it still exists in memory:

Unload ProgressFRM

combo
 
Thanks guys,

The line that really halped me out was DoEvents.

I didn't know that forms were an opertaing system event and DoEvents pushed through these events when screenupdating had effectively frozen the excel screen. I'll also use unload ProgressFRM instead of hide Progress FRM, I don't know what the difference is but is sounds better.

Thanks
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top