Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I keep a text box on the screen when scrolling? | Excel Discussion (Misc queries) | |||
Live Scrolling/Real-Time /Smooth Scrolling doesn't work for me in Excel, even 2007 beta | Excel Discussion (Misc queries) | |||
Live Scrolling/Real-Time /Smooth Scrolling doesn't work for me in Excel 2003 | Excel Discussion (Misc queries) | |||
Scrolling text box | Excel Discussion (Misc queries) | |||
How to create a text scrolling window? | New Users to Excel |