Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Scrolling text

Hi all.
Following Access VBA code, scroll text in a label name lblScroll of a Form.
- Timer interval 250
- On Timer following code:

Private Sub Form_Timer()
Static strMsg As String, intLet As Integer, intLen As Integer
Dim strTmp As String
Const TXTLEN = 40
If Len(strMsg) = 0 Then
strMsg = Space(TXTLEN) & "Welcome all" & Space(TXTLEN)
intLen = Len(strMsg)
End If
intLet = intLet + 1
If intLet intLen Then intLet = 1
strTmp = Mid(strMsg, intLet, TXTLEN)
lblScroll.Caption = strTmp
End Sub

How gets same results in Excel Userform using API ?
Regards, John.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Scrolling text

Add two buttons - cmdStart and cmdStop to a userform,
plus a label- lblScroll
Add the following code - I used yours without any
changes...


Option Explicit
Private bStop As Boolean
Sub New_Timer()
Dim t As Double
Do
t = Timer
Form_Timer
Do
DoEvents
Loop Until Timer (t + 0.25)
Loop Until bStop
End Sub

Private Sub Form_Timer()
Static strMsg As String, intLet As Integer, _
intLen As Integer
Dim strTmp As String
Const TXTLEN = 40
If Len(strMsg) = 0 Then
strMsg = Space(TXTLEN) & "Welcome all" & _
Space(TXTLEN)
intLen = Len(strMsg)
End If
intLet = intLet + 1
If intLet intLen Then intLet = 1
strTmp = Mid(strMsg, intLet, TXTLEN)
lblScroll.Caption = strTmp
End Sub
Private Sub cmdStart_Click()
bStop=False
Call New_Timer
End Sub
Private Sub cmdStop_Click()
bStop = True
End Sub

ru the form. click the start button to begin scrolling &
the stop button to stop it. Thje keys are (1) the boolean
bStop which is used to control the outer do-loop and
the 'timer' do-loop that controls the wait period after
calling the scrolling sub (ie your code)
Essentially the sub New_Timer replaces the in-built
Access timer.

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Hi all.
Following Access VBA code, scroll text in a label name

lblScroll of a Form.
- Timer interval 250
- On Timer following code:

Private Sub Form_Timer()
Static strMsg As String, intLet As Integer, intLen

As Integer
Dim strTmp As String
Const TXTLEN = 40
If Len(strMsg) = 0 Then
strMsg = Space(TXTLEN) & "Welcome all" & Space

(TXTLEN)
intLen = Len(strMsg)
End If
intLet = intLet + 1
If intLet intLen Then intLet = 1
strTmp = Mid(strMsg, intLet, TXTLEN)
lblScroll.Caption = strTmp
End Sub

How gets same results in Excel Userform using API ?
Regards, John.


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Scrolling text

Thanks Patrick.
Regards, John.
"Patrick Molloy" ha scritto nel messaggio
...
Add two buttons - cmdStart and cmdStop to a userform,
plus a label- lblScroll
Add the following code - I used yours without any
changes...


Option Explicit
Private bStop As Boolean
Sub New_Timer()
Dim t As Double
Do
t = Timer
Form_Timer
Do
DoEvents
Loop Until Timer (t + 0.25)
Loop Until bStop
End Sub

Private Sub Form_Timer()
Static strMsg As String, intLet As Integer, _
intLen As Integer
Dim strTmp As String
Const TXTLEN = 40
If Len(strMsg) = 0 Then
strMsg = Space(TXTLEN) & "Welcome all" & _
Space(TXTLEN)
intLen = Len(strMsg)
End If
intLet = intLet + 1
If intLet intLen Then intLet = 1
strTmp = Mid(strMsg, intLet, TXTLEN)
lblScroll.Caption = strTmp
End Sub
Private Sub cmdStart_Click()
bStop=False
Call New_Timer
End Sub
Private Sub cmdStop_Click()
bStop = True
End Sub

ru the form. click the start button to begin scrolling &
the stop button to stop it. Thje keys are (1) the boolean
bStop which is used to control the outer do-loop and
the 'timer' do-loop that controls the wait period after
calling the scrolling sub (ie your code)
Essentially the sub New_Timer replaces the in-built
Access timer.

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Hi all.
Following Access VBA code, scroll text in a label name

lblScroll of a Form.
- Timer interval 250
- On Timer following code:

Private Sub Form_Timer()
Static strMsg As String, intLet As Integer, intLen

As Integer
Dim strTmp As String
Const TXTLEN = 40
If Len(strMsg) = 0 Then
strMsg = Space(TXTLEN) & "Welcome all" & Space

(TXTLEN)
intLen = Len(strMsg)
End If
intLet = intLet + 1
If intLet intLen Then intLet = 1
strTmp = Mid(strMsg, intLet, TXTLEN)
lblScroll.Caption = strTmp
End Sub

How gets same results in Excel Userform using API ?
Regards, John.


.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I keep a text box on the screen when scrolling? Paulm Excel Discussion (Misc queries) 1 July 27th 06 01:37 PM
Live Scrolling/Real-Time /Smooth Scrolling doesn't work for me in Excel, even 2007 beta [email protected] Excel Discussion (Misc queries) 2 July 21st 06 01:21 AM
Live Scrolling/Real-Time /Smooth Scrolling doesn't work for me in Excel 2003 [email protected] Excel Discussion (Misc queries) 0 May 12th 06 03:15 AM
Scrolling text box peabrain25 Excel Discussion (Misc queries) 0 April 12th 06 10:06 PM
How to create a text scrolling window? Rickk New Users to Excel 1 January 29th 05 02:29 AM


All times are GMT +1. The time now is 01:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"