LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default animated text in a userform?

Hi,

If you really, really want to do it try using this variation of a marquee.
http://www.ozgrid.com/forum/showthre...hlight=marquee

Userform with additional Toolbox control. MS Web browser.

userform code that will, when clicked, display the contents of A1 on active
sheet.
Private Sub UserForm_Click()

Dim intUnit As Integer
Dim strTemp As String

strTemp = "<html<head<script language=""javascript""function
noScroll(){document.body.scroll=""no"";}" & _
"</script</head<body onload=javascript:noScroll();
topmargin=""0"" leftmargin=""0""" & _
"<marquee width=""198"" height=""22""" & _
Range("A1").Value & _
"</marquee</body</html"
intUnit = FreeFile
Open ThisWorkbook.Path & "\zzxqvk.htm" For Output As intUnit
Print #intUnit, strTemp
Close intUnit
Me.WebBrowser1.Navigate2 ThisWorkbook.Path & "\zzxqvk.htm"
Me.WebBrowser1.Visible = True

End Sub

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Trevithick" wrote in message
...
I agree with Rick and have used his technique in the past. Assigning the
long string to the ControlTipText property is an easy and clean way to
still
make your message available. To me, a clean interface is critical for end
users.

However, having said that, I thought I recalled John Walkenbach having an
example in his Excel 2007 Power Programming with vba. I was right, but
tried
unsuccessfully for a couple of hours to cobble something together that
would
work using the method I mentioned above.

I finally broke down and retrieved from my library of Walkenbach books the
answer. I was right in remembering an example. I finally modified my
close
but no cigar method and used insights from Walkenbach's example and got it
to
"work". I was unsuccessful even after getting it to scroll, to control
the
speed of the scrolling. It is unreadable because of the speed that it
refreshes the label. And, it also required a control on the UserForm to
initiate and stop the scrolling. I could not discover a way to cause it
to
scroll without it. Perhaps, and I didn't try it, use a mouseover event
for
the initiation.

All the code resides in the UserForm, and follows:

Option Explicit

Dim myString As String
Dim myStringLen As Integer
Dim myLabel As String
Dim myLabelLeft As String
Dim myLabelRight As String
Dim myCaption As String
Dim myCaptionLeft As String
Dim myCaptionRight As String
Dim x As Integer
Dim myInterval As Integer
Dim Stopped As Boolean

Private Sub cmdStartStop_Click()

myString = "Let me see if I can think of some long string to scroll. "
myStringLen = Len(myString)
myLabel = myString
myCaption = myString
myInterval = 7

If cmdStartStop.Caption = "Start" Then
cmdStartStop.Caption = "Stop"

Stopped = False

Do Until Stopped
For x = 1 To myStringLen

'Display controls
lblScrollText = myLabel
txtX = x
txtLabelLength = myStringLen
frmScrollText.Caption = myCaption

'Change myLabel
myLabelLeft = Left(myLabel, myInterval)
myLabelRight = Right(myLabel, myStringLen - myInterval)
myLabel = myLabelRight & myLabelLeft

'Change myCaption
myCaptionLeft = Left(myCaption, myStringLen - myInterval)
myCaptionRight = Right(myCaption, myInterval)
myCaption = myCaptionRight & myCaptionLeft

DoEvents 'Causes the animation
Next
Loop

Else
Stopped = True
cmdStartStop.Caption = "Start"

End If

End Sub
--
Mark Trevithick


"Rick Rothstein" wrote:

See inline comments...

Is the ControlTipText thing sort of like a floating text box
kinda similar to the comment-box that you can install in Excel
cells?? This might be what I'm looking for.


Yes, but unlike the Comment Box which activates immediately, there is a
slight delay before the ControlTipText displays.

BTW, if another application is in the foreground, and Excel
is behind/underneath it (but partially visible), AND if I hover
the mouse pointer over my userform (which is in the background),
will the ControlTipText still appear??? (I hope that question
isnt too confusing, hehe!)


No, the ControlTipText will only activate if the UserForm has focus (this
is
pretty much standard Windows functionality).

--
Rick (MVP - Excel)



"Rick Rothstein" wrote in message
...
I agree with Mark... this will drive your users crazy and it will be
hard
to read. What about assigning the long text to the ControlTipText
property
of the Label? That way, unless the text is humungously long, it will be
be
displayed in its entirety when the user hovers the mouse over the
control.

--
Rick (MVP - Excel)



.


 
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
animated text in excel Vijay_India Excel Worksheet Functions 9 May 14th 23 07:42 PM
putting help text in the animated bubble Pete Derkowski Excel Worksheet Functions 3 July 30th 08 06:53 PM
Animated gif on userform Avi Excel Programming 0 May 15th 06 06:38 AM
can you get animated text in excel? EMT Excel Discussion (Misc queries) 1 October 18th 05 12:28 PM
adding animated *.gif's to a text box Mark Kubicki Excel Programming 1 July 30th 03 11:52 PM


All times are GMT +1. The time now is 11:25 PM.

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

About Us

"It's about Microsoft Excel"