Hey, I have been using the traditional progress indicator for some time now and am interested in a new design. I have created a new progress indicator style similar to the one we see in other windows applications ( The donut graph with 4 slices). I am wondering if it is possible to create a standalone progress indicator that runs independently of other procedures. For instance, I can create a progress indicator that is "Updated" everytime a loop reaches a certain point by calling the procedure, at which case the procedure will focus its attention on updating the progress bar then once the progress bar "Updated" event occurs, it will continue the look. As you can imagine, this is not realistic with a Donut style indicator because the slices need to be timed so that the circular sliced rotate. However, I have not found anyway to "execute two loops at the same time" ( not in succession). I have the following format so far, but I somehow am looking to overcome the fact that so far I am limited to one loop at a time.
I have attached what I have come up with so far. It is a worksheet with a few buttons that imitate what I would like to see...hope an MVP out there knows the answer!
Issue; after pressing "Show Progress Indicator" in my spreadsheet, then pressing "Random Value Setting", the wheel stops spinning
I think we can all use an updated progress bar..
here is my module code
Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public completed As Boolean
Public Sub SpinUserform1Graph()
Dim ctl As msforms.Control
Dim i As Integer
i = 1
Do Until i = 4
For Each ctl In UserForm1.Controls
If TypeName(ctl) = "Image" Then
ctl.Visible = True
DoEvents
Sleep 100
ctl.Visible = False
End If
Next ctl
i = i + 1
Loop
Unload UserForm1
Set ctl = Nothing
End Sub
Sub ShowUserform()
Dim r As Integer
UserForm1.Show vbModeless
Dim ctl As msforms.Control
Dim i As Integer
i = 1
Do Until completed = True
For Each ctl In UserForm1.Controls
If TypeName(ctl) = "Image" Then
ctl.Visible = True
DoEvents
Sleep 100
ctl.Visible = False
End If
Next ctl
i = i + 1
Loop
Set ctl = Nothing
End Sub
Sub CallShowUserform()
completed = False
UserForm1.Show vbModeless
End Sub
Sub SetCompleteToTrue()
completed = True
End Sub
Sub UnloadUserform()
Unload UserForm1
End Sub
Sub RandomValuesetting()
Application.ScreenUpdating = False
Dim r As Integer
Dim c As Integer
r = 17
Do Until r = 1900
c = 1
Do Until c = 8
Cells(r, c).Value = 500 * c
c = c + 1
Loop
r = r + 1
Loop
Application.ScreenUpdating = True
End Sub
I also have a userform event procedures
Private Sub UserForm_Initialize()
ShowUserform
End Sub
The userform basically has 8 jpeg images that rotate from being visible to being false. THey all overlap eachother... In summary, I would like the timed donut rotation to occur while other code is executing, with the donut rotation stopping only once the entire main procedure has ended. I can imagine others would like this type of feature?
Bookmarks