The code bellow shows you how to implement progressbar without getting error:
Dim i As Integer
For i = 0 To 100
Do While (ProgressBar1.Value < 100)
ProgressBar1.Value = ProgressBar1.Value + 1
Application.DoEvents()
Loop
Next