Hello,
I am doing data extraction processing and calculations - it takes a while. I would like to show a progress meter. I found some interesting progress meters at
http://www.andypope.info/vba/pmeter.htm'
Here is teh code:
Private Sub UserForm_Click()
'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
'Progress bar'
'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Sub progress()
Dim intIndex As Integer
Dim sngPercent As Single
Dim intMax As Integer
intMax = 100
For intIndex = 1 To intMax
sngPercent = intIndex / intMax
ProgressStyle5 sngPercent
ProgressStyle6 sngPercent
DoEvents
'------------------------
' Your code would go here
'------------------------
Sleep 100
Next
Public Sub ProgressStyle5(Percent As Single)
'
' Progress Style 5
' Label Over Label changing text content
' Growth
Dim strTemp As String
Dim intIndex As Integer
intIndex = Int(Len(UserForm2.labPg5a.Caption) * Percent)
If intIndex > 0 Then
strTemp = String(intIndex, "•") & String(Len(UserForm2.labPg5a.Caption) - intIndex, " ")
Else
strTemp = String(Len(UserForm2.labPg5a.Caption), " ")
End If
UserForm2.labPg5.Caption = strTemp
End Sub
Public Sub ProgressStyle6(Percent As Single)
'
' Progress Style 6
' Label Over Label changing text content
' Pulsing
'
Dim strTemp As String
Dim intIndex As Integer
intIndex = Int((Percent * 100) Mod (Len(UserForm2.labPg6a.Caption) + 1))
strTemp = String(Len(UserForm2.labPg6a.Caption), " ")
If intIndex > 0 Then
Mid(strTemp, intIndex, 1) = "•"
End If
UserForm2.labPg6.Caption = strTemp
End Sub
End Sub
I am not sure how to incorporate this into my macro. Do I need to put the code in the progress meter form or do I need to combine it with the codes in module? I don't understand how progress meter and macro runs parallely. Please help.
Thanks, Anil
Bookmarks