We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

How do I programatically scroll down on a webpage inside the MS Web Control?

yyuubum2
yyuubum2 asked
on
Medium Priority
419 Views
Last Modified: 2010-08-05
I have the MS Web browser control on a form.
I have it load a page that is longer than the viewing area.
How can I code so that the page will automatically slowly scroll down to the end while it is being viewd?
(speed variable please)
Comment
Watch Question

High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
Experiment with...

Option Explicit

Private Sub Form_Load()
    Timer1.Enabled = False
    Timer1.Interval = 250
    WebBrowser1.Navigate "http://www.google.com"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If WebBrowser1.Document.body.scrollTop < WebBrowser1.Document.body.scrollheight Then
        WebBrowser1.Document.parentWindow.scrollTo 0, WebBrowser1.Document.body.scrollTop + 1
    Else
        Timer1.Enabled = False
    End If
End Sub

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Idle Mind:
You've done it...just one more tweek for more points?
Can you include a test to see if the page has scrolled to the end or the max on the scrollbar?
In otherwords, when its finished?

Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009

Commented:
I couldn't find any obvious ways to figure out if I'd reached the ~end~.

I'll keep digging...

Author

Commented:
still hoping you can help
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.