WebScraper
New Member
- Joined
- Aug 21, 2017
- Messages
- 4
Hello,
I've found a webpage with some investment products that I would like to export to Excel with some help from VBA. On the webpage there is a small image on the left-side bottom of the page and when I hoover it, it says 'Export table to spreadsheet'. I've tried to 'Inspect element' in order to find an ID or tagname of the image but with no luck Further on there is a dropdown next to it that I would like to give the value=6 so I get all products in one single file.
What I would like to do is
My code - so far - looks like this:
Eventhough it finds all links embedded to images my code doesn't click on the one I would like it to (at least how I see it when I debug it).
Anyone who can help me find the righ image I should click on and a method so I can set the dropdown value before I click?
Thank in advance
I've found a webpage with some investment products that I would like to export to Excel with some help from VBA. On the webpage there is a small image on the left-side bottom of the page and when I hoover it, it says 'Export table to spreadsheet'. I've tried to 'Inspect element' in order to find an ID or tagname of the image but with no luck Further on there is a dropdown next to it that I would like to give the value=6 so I get all products in one single file.
What I would like to do is
- Call the URL
- Set the dropdown, 'Select the number of pages...' to 6
- Click on the image 'Export table to spreadsheet'
My code - so far - looks like this:
Code:
Sub getTuringData()
Dim IE As New InternetExplorer, Url as String
Dim HtmlDoc As New MSHTML.HTMLDocument
Dim ElementCol As Object, Link As Object
Url="[url=http://turing.ngm.se/MDWebFront/quotes.html?underlying=OMXS30&instrumentType=MiniFuture&putCall=CALL&activeTab=ndxQuotes&******]MDWeb Quotes[/url]"
With IE
.navigate Url
.Visible = True
Do While .Busy Or .READYSTATE <> READYSTATE_COMPLETE
DoEvents
Loop
Set HtmlDoc = .document
End With
Application.Wait (Now + TimeValue("00:00:01")) 'Wait so the page loads all Javascript
Set ElementCol = HtmlDoc.getElementsByTagName("img")
For Each Link In ElementCol
Link.Click
Next
IE.Quit
End Sub
Eventhough it finds all links embedded to images my code doesn't click on the one I would like it to (at least how I see it when I debug it).
Anyone who can help me find the righ image I should click on and a method so I can set the dropdown value before I click?
Thank in advance