The Macro gives a progress bar in the status bar it works except that for:
For i = 1
the status bar says "Starting...." there is 1 filed square (as it should be) but it executes the "call Sub1"
for i = 2
the status bar update and says "Processing Sub1...." and there are 2 filed squares (as there should be now) but it executes the "call Sub2"
for i = 3
the status bar update and says "Processing Sub2...." and there are 3 filed squares (as there should be now) but it executes the "call Sub3"
I am not understanding how "StatusBarProgressMeter" works or is something wrong with my code writing
Thanks
Sub StatusBarProgressMeter()
Dim i As Integer
Dim sMessage As String
For i = 1 To 5
If i = 1 Then
sMessage = "Starting...."
ElseIf i = 2 Then
sMessage = "Processing Sub1..."
Call Sub1
ElseIf i = 3 Then
sMessage = "Processing Sub2...."
Call Sub2
ElseIf i = 4 Then
sMessage = "Processing Sub3..."
Call Sub3
ElseIf i = 5 Then
sMessage = "Finishing...."
Else
sMessage = ""
End If
Call LjmStatusBarProgressMeter(i, 5, sMessage)
Application.Wait Now + TimeValue("00:00:01")
Next i
Application.DisplayStatusBar = False
End Sub
Sub LjmStatusBarProgressMeter(iValue As Integer, iValueMax As Integer, sMessage As String)
'This displays a progress bar on the 'Status' Bar
Dim lWord As Long
' make StatusBar visible
Application.DisplayStatusBar = True
lWord = 9609 'Filled in big squares
lWord = &H22A1 'Empty little squares
lWord = &H2610 'Empty big squares
'Output the Status Bar
Application.StatusBar = String(iValue, ChrW(9609)) & String(iValueMax - iValue, ChrW(lWord)) & " " & sMessage
'Application.StatusBar = String(iValue, ChrW(9609)) & " " & sMessage
End Sub
Bookmarks