Status Bar

The StatusBar property allows you to assign a text string to be displayed at the left-hand side of the Excel status bar at the bottom of the screen. This is an easy way to keep users informed of progress during a lengthy macro operation. It is a good idea to keep users informed, particularly if you have screen updating turned off and there is no sign of activity on the screen. Even though you have turned off screen updating, you can still display messages on the status bar.

The following code shows how you can use this technique in a looping procedure:

Sub ShowMessage()

Dim lCounter As Long

For lCounter = 0 To 100000000

If lCounter Mod 1000000 = 0 Then

Application.StatusBar = "Processing Record 1

' & lCounter

End If

Next lCounter

Application.StatusBar = False

End Sub

At the end of your processing, you must set the StatusBar property to False so that it returns to normal operation. Otherwise, your last message will stay on the screen.

Was this article helpful?

0 0

Post a comment