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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display a progress window with VBA in Outlook 2003

Status
Not open for further replies.

irbk

MIS
Oct 20, 2004
578
US
I've got a small program that I wrote (with help from you wolderfull folks here) that works great. I just have 1 last thing that I would like to add to it. Since the program can some times take a while to process, I would like to display a progress bar type item while the program is going. Is this a simple process to do?

Thanks in advance.
 
Pretty simple. You will need to add the control of your choice to the form, Microsoft ProgressBar Control, version 6.0 works for me.

To update the control as your routine runs you just need to increment the [tt]Value[/tt] of the control from 1 to the [tt]Max[/tt] value. This can be done with time, or as steps in your procedure are completed. Here is an example[ol][li]Create a new [tt]UserForm[/tt][/li][li]Draw a Progress Bar on the form ([tt]ProgressBar1[/tt])[/li][li]Add the following code to the form:
Code:
Private Sub UserForm_Initialize()
'Set the maximum value when the form opens
Me.ProgressBar1.Max = 5
End Sub

Private Sub UserForm_Click()
If Me.ProgressBar1.Value = 5 Then
  Me.ProgressBar1.Value = 0
Else
  Me.ProgressBar1.Value = Me.ProgressBar1.Value + 1
End If
End Sub
[/li][/ol]

This should increment the bar each time the form is clicked.

Hope this helps,
CMP



(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top