Consulting

Results 1 to 3 of 3

Thread: scrolling text on a form

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    scrolling text on a form

    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

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,891
    perhaps:
    [vba]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
    [/vba]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,776
    Perhaps

    [VBA]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
    [/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •