Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

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

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)
0
yyuubum2
Asked:
yyuubum2
  • 2
  • 2
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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
0
 
yyuubum2Author 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?

0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I couldn't find any obvious ways to figure out if I'd reached the ~end~.

I'll keep digging...
0
 
yyuubum2Author Commented:
still hoping you can help
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now