William Benson (VBACreations.Com)
vbacreations at gmail.com
Sat Jun 25 20:39:33 CDT 2011
I don't really recommend messing with the caption of a form because it is possible that the code could be interrupted and then the form caption is permanently screwed up - but if you run out of other options, throw this in a form and give it a run. The effect might be interesting. Of course, you would never do this on the form time but it is for illustration purposes. Option Compare Database Option Explicit Private Sub Form_Load() Me.TimerInterval = 500 End Sub Private Sub Form_Timer() Method2 End Sub Sub Method1() Static MyCount MyCount = MyCount + 1 If MyCount = 1 Or MyCount > 5 Then Caption = Chr(8) MyCount = 1 Else Caption = String(MyCount, Chr(8)) End If End Sub Sub Method2() Static MyCount Const UPPERLIMIT As Long = 10 MyCount = MyCount + 1 Caption = "Running some code ... " & Chr(8) & Chr(8) & Chr(8) & " " & _ IIf(MyCount = UPPERLIMIT, "DONE", Format(MyCount / UPPERLIMIT, "0 %")) & _ " " & Chr(8) & Chr(8) & Chr(8) If MyCount = UPPERLIMIT Then MyCount = 0 End Sub