animated stautus bar

seacrest

Active Member
Joined
Aug 15, 2002
Messages
301
I copied the following code from this site It works great but it runs continuously I would like it to run for about 10 seconds on
opening my spreadsheet. Can you help?




Public Sub animatestatusbar()

Dim sText As String
Dim iLength As Integer
Dim bForwards As Boolean


sText = "Hello"
iLength = Len(sText) + 1
bForwards = True

Do
DoEvents

If bForwards Then
sText = " " & sText
Else
sText = Right(sText, Len(sText) - 1)
End If

If Len(sText) > 30 Then
bForwards = False
End If

If Len(sText) < iLength Then
bForwards = True
End If
Sleep 300
Application.StatusBar = sText
Loop

End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

seacrest

Active Member
Joined
Aug 15, 2002
Messages
301
sorry i left this off the very top



Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
 

s-o-s

Active Member
Joined
Apr 14, 2002
Messages
384
The following amended will now work for approx 10 seconds.

Code:
Private Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)


Public Sub animatestatusbar()

Dim sText As String
Dim iLength As Integer
Dim bForwards As Boolean


sText = "Hello"
iLength = Len(sText) + 1
bForwards = True
rep = 0

Do
DoEvents
rep = rep + 1
If bForwards Then
sText = " " & sText
Else
sText = Right(sText, Len(sText) - 1)
End If

If Len(sText) > 30 Then
bForwards = False
End If

If Len(sText) < iLength Then
bForwards = True
End If
Sleep 150
Application.StatusBar = sText
If rep > 50 Then GoTo break
Loop
break:
Application.StatusBar = ""
End Sub
 

Forum statistics

Threads
1,143,915
Messages
5,721,506
Members
422,369
Latest member
redinator

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top