Marshall Brooks
Member
- Local time
- Today, 04:55
- Joined
- Feb 28, 2023
- Messages
- 720
Some of my forms take a while to load - especially when I am working at home, so I wanted to add a progress bar to show their progress.
I have no idea how long the file will take to load, so this will be one of those progress bars that just moves across the screen and then starts over again.
I am using a modified version of the progress bar shown here:
wellsr.com
Typically, the code would look like this:
For a first attempt, I'm wanting the progress bar to update twice a second and increment 1 per-cent per second.
I thought I only needed this code in the Form_Timer() procedure:
And the "unload ufProgress" and "Me.TimerInterval = 0" lines in the Form Activate event, but nothing seemed to happen.
I added to Form_Load():
And I see the Progress Bar open and close, but no indication of movement. (It's possible it loads in less than a second - I can't really tell that now, but if I change the timer interval to 1, I don't see any progress either.
Where did I go wrong?
Thanks in advance!!!
I have no idea how long the file will take to load, so this will be one of those progress bars that just moves across the screen and then starts over again.
I am using a modified version of the progress bar shown here:

Beautiful VBA Progress Bar with Step by Step Instructions - wellsr.com
Make your macros stand out by creating this beautiful VBA Progress Bar to illustrate the progress. This tutorial walks you through how to make the UserForm.

Typically, the code would look like this:
Code:
With ufProgress
.LabelCaption.caption = " Running Event 1"
.LabelProgress.Width = 0
.Show
.Repaint
End With
' Do Event 1'
With ufProgress
.LabelCaption.caption = " Running Event 2"
.LabelCaption.caption = " Updating Templates"
.LabelProgress.Width = 0.5 * (.FrameProgress.Width)
.Show
.Repaint
End With
' Do Event 2
Unload ufProgress
I thought I only needed this code in the Form_Timer() procedure:
Code:
Private Sub Form_Timer()
Dim I As Integer
Me.TimerInterval = 500 ' 1/2-second
I = (I + 1) / 2
If I > 100 Then
I = 0
End If
With ufProgress
.LabelCaption.caption = " Loading frmForm A"
.LabelProgress.Width = I / 100 * (.FrameProgress.Width)
.Show
.Repaint
DoEvents
End With
End Sub
And the "unload ufProgress" and "Me.TimerInterval = 0" lines in the Form Activate event, but nothing seemed to happen.
I added to Form_Load():
Code:
Me.TimerInterval = 500 ' 1/2 second
With ufProgress
.LabelCaption.caption = " Loading C-130J TCTOs"
.LabelProgress.Width = 0 / 100 * (.FrameProgress.Width)
.Show
.Repaint
End With
And I see the Progress Bar open and close, but no indication of movement. (It's possible it loads in less than a second - I can't really tell that now, but if I change the timer interval to 1, I don't see any progress either.
Where did I go wrong?
Thanks in advance!!!
Last edited: