View Single Post
 
Old 08-30-2021, 06:15 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

You are right, they are called labels in English versions of Office too. OK, try this code where the text is in a label called labelTicker
Code:
#If VBA7 And Win64 Then    ' For 64bit versions
    Private Declare PtrSafe Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As LongPtr)
#Else    ' For 32bit versions
    Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
#End If

Private Sub UserForm_Activate()
  Dim iWidth As Integer, iFormWidth As Integer, iStep As Integer
  
  iStep = 1
  iFormWidth = Me.Width - 20
  With Me.labelTicker
    .Left = iFormWidth
    Do
      Sleep 20
      DoEvents
      If .Left > -1 * .Width Then
        .Left = .Left - iStep
      Else
        .Left = iFormWidth
      End If
    Loop
  End With
End Sub

Private Sub UserForm_Initialize()
  With Me
    .Top = Application.Top + 0.5 * (Application.Height - .Height)
    .Left = Application.Left + 0.5 * (Application.Width - .Width)
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote