Ok, I looked all over to find a web page displaying this, with no success. So I will try to explain it the best way i can without writing the code, because it can get rather lengthy...Also note that I told you to place the code in the Initialize event...dont do this! I have a remedy below...
o Build a userform (not to large), and change its Caption property to "ProgBar"
o Add a Frame Control in the center, and name it "FrmProg"
o Add a label control inside of the Frame and make its background color blue, name this LblProg, and change its special effect to frmSpecialEffectRaised
o Now you should have a rectangular Userform, a frame in the center with a long bar inside the frame (the bar is just the label with a blue background)
o Place the following code in the code for the userform, replacing xxx with your prodedure (the one you want to have running in the background while the status bar is in front)
Private Sub UserForm_Activate()
Call xxx
End Sub
o Insert the following code after that:
Sub UpdateProg(Pct)
With ProgBar
.frmProg.Caption = Format(Pct, "0%")
.LblProg.Width = Pct * (.frmProg.Width - 5)
.Repaint
End With
End Sub
o YOUR ALMOST DONE! Now, you want to insert calls to UpdateProg throughout your xxx procedure, the with the parameter Pct equal to the percent your xxx procedure is completed. For example, when the code is 50% done, place "Call UpdateProg(.5)" in your xxx procedure.
o To get it to run, instead of calling the xxx procedure, load the form and show it, NEVER CALLING XXX (this is important). Do this by inserting the following wherever you initially called XXX, call it say ShowProgIndicator:
Sub ShowProgIndicator()
Load frmProg
frmProg.LabelProg.width=0
frmProg.Show
End Sub
WHEW taht was a lot... Remember the key is to situate all teh objects on your form so it looks like a progress bar youve seen before, then run the code...GOOD LUCK!!!
Chris