(Download and Try Free) MS Excel Macros 3 ----- Marquee on Excel Worksheet

267 views
Skip to first unread message

ashish

unread,
Jun 2, 2012, 5:22:33 AM6/2/12
to excelvb...@googlegroups.com

If you want to display marquee/running text on excel worksheet. 


Follow below mention steps-

Step1 


Step 2



Once you have added the web browser on the worksheet. 

Add below code module1 or any new module

Sub run_marquee()
' EXAMPLE 1
Dim mbody As String
' add the text of amrquee and creat a html webpage
mbody = "<p style=""font-size:18px;""><marquee behavior=""scroll"" direction=""left"">www.excelvbamacros.com</marquee>"
Open ThisWorkbook.Path & "\marquee_sample1.htm" For Output As #1
Print #1, mbody
Close #1
' add the webpage to webbrowser
Sheets(1).WebBrowser1.Navigate ThisWorkbook.Path & "\marquee_sample1.htm"
' reduce the size of webbrowser
Sheets(1).WebBrowser1.Height = 30
Sheets(1).WebBrowser1.Width = 800
End Sub 

Add below code to worksheet module

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
' to remove the scroll bars
On Error Resume Next
Me.WebBrowser1.Document.body.scroll = "no"
End Sub



 

Reply all
Reply to author
Forward
0 new messages