-1

I was trying to find a way to scroll (down, up) a webpage with vba.

I have a page where I need to fill in some information. This part is working. The only thing, it happens somewhere down there and I would like to see it happening so I need to scroll the window down in a way... is there a trick?

Thanks a lot!!!

QHarr
  • 80,579
  • 10
  • 51
  • 94
Uni YaMo
  • 21
  • 2
  • 5
  • What packages (references) are you using? Ex, if you're using selenium, this might help :http://stackoverflow.com/questions/3401343/scroll-element-into-view-with-selenium – user3476534 Sep 12 '15 at 22:28

2 Answers2

1

You can execute javascript to scroll on the page e.g.

Option Explicit
Public Sub ScrollWindow()
    Dim ie As New InternetExplorer
    With ie
        .Visible = True
        .navigate "https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollBy"
        While .Busy Or .readyState < 4: DoEvents: Wend
        .document.parentWindow.execScript "window.scrollBy(0, window.innerHeight);", "javascript"
        Stop '<== Delete me
        .Quit
    End With
End Sub
QHarr
  • 80,579
  • 10
  • 51
  • 94
0

Hello and thanks for your reply. I'm not using selenium.. But I did find a way to get around it: 1. Simply by using:

SendKeys "{Down}"

  1. But this wasn't accurate enough so I did this:

.Navigate "web-address" & "#location-name"

As stated when inspecting the element.

I hope my findings can be helpful for someone out there ;)

Thanks again for your reply!

Uni YaMo
  • 21
  • 2
  • 5