Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrolling in WebBrowser 2

Status
Not open for further replies.

rikeman

Programmer
Sep 18, 2004
40
BE
Hello,

can someone tell me how I can scroll in a simple webbrowser; for example: when I click on a command button, the webbrowser must go to the bottom of the page.
 
Can I also scroll to the middle of the page?
 
Down Arrow
SendKeys "{DOWN}"

Up arrow
SendKeys "{UP}"

Change the following if necessary
PAGE DOWN {PGDN}
PAGE UP {PGUP}

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Oh, you can be a bit more accurate than that with your scrolling...
Code:
[blue]Dim MaxScrollX
    MaxScrollY = WebBrowser1.Document.body.scrollHeight ' max scrollable Y position in pixels
    WebBrowser1.Document.parentWindow.scrollTo 0, MaxScrollY ' scroll all the way down
    WebBrowser1.Document.parentWindow.scrollTo 0, MaxScrollY / 2 'scroll halfway down[/blue]
 
strongm,
Great!!

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Strongm

"Dim MaxScrollX"

Was that a test?

If so did I pass?

[gray]Experience is something you don't get until just after you need it.[/gray]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top