VBAで進行状況をステータスバーに表示する

進行状況|++                  |10%
進行状況|++++                |20%
進行状況|++++++              |30%
進行状況|++++++++            |40%
進行状況|++++++++++          |50%
進行状況|++++++++++++        |60%
進行状況|++++++++++++++      |70%
進行状況|++++++++++++++++    |80%
進行状況|++++++++++++++++++  |90%
進行状況|++++++++++++++++++++|100%
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub main()
    Call printStatus(0)
    Sleep (1000)
    Call printStatus(10)
    Sleep (1000)
    Call printStatus(20)
    Sleep (1000)
    Call printStatus(30)
    Sleep (1000)
    Call printStatus(40)
    Sleep (1000)
    Call printStatus(50)
    Sleep (1000)
    Call printStatus(60)
    Sleep (1000)
    Call printStatus(70)
    Sleep (1000)
    Call printStatus(80)
    Sleep (1000)
    Call printStatus(90)
    Sleep (1000)
    Call printStatus(100)
    MsgBox "Finish"
End Sub

Private Sub printStatus(intPercent As Integer)

    'ステータスバーの初期化
    If intPercent = 0 Then
        Application.StatusBar = ""
        Exit Sub
    End If
    
    '変数定義
    Dim strBar As String
    Dim intBarLength As Integer
    Dim intBlankLength As Integer
    
    '表示文字数の制御
    intBarLength = intPercent / 5
    intBlankLength = 20 - intBarLength
    
    '進行状況文字列の生成
    For i = 1 To intBarLength
        strBar = strBar & "+"
    Next i
    
    'ブランク文字列の結合
    For i = 1 To intBlankLength
        strBar = strBar & " "
    Next i
    
    Debug.Print "進行状況|" & strBar & "|" & intPercent & "%"
    Application.StatusBar = "進行状況|" & strBar & "|" & intPercent & "%"

End Sub