PDA

View Full Version : scrolling text on a form



philfer
12-18-2010, 03:35 PM
Hello,

I am trying to create a form that has scrolling text on it. I do :-

Private Sub UserForm_Activate()

For i = 1 To 10
If Application.Wait(Now + TimeValue("0:00:01")) = True Then
Me.lblMessage.Caption = Mid("***Happy Xmas****", i, 15)
Me.Repaint
End If
Next i

Unload Me

End Sub

and it works fine but is slow. When I do :-

If Application.Wait(Now + (TimeValue("0:00:01")+0.5)) = True Then

instead the form just loads and unloads in a blink of an eye.

Is there an easier way to animate a form

Thanks
Phil

p45cal
12-18-2010, 07:53 PM
perhaps:
Private Sub UserForm_Activate()
For i = 1 To 10
endtime = Timer + 0.12
Do While Timer < endtime: Loop
Me.lblMessage.Caption = Mid("***Happy Xmas****", i, 15)
Me.Repaint
Next i
Unload Me
End Sub

mikerickson
12-19-2010, 01:09 AM
Perhaps

Private Sub UserForm_Click()
Dim i As Long
For i = 1 To 10 Step 2
Me.Caption = Mid("***Happy Xmas****", i, 15)
Application.Wait Now + TimeValue("0:00:01")
Next i
End Sub