Hi everyone,
I haven't done much VBA interaction with IE and am doing this to learn as much as I can. So any help/tips or tricks/better ways to do this would be greatly appreciated. I have already spend a huge amount of time getting to where I am now and am using Excel Forum as a last resource, so I'm sincerely asking for help.
Please see the following website: http://www.afl.com.au/stats
Problem 1: I am able to get vba to select "SEASON" from the dropdown boxes But the data stays the same (very wrong). I think I am missing an .fireEvent or run Function? or a "reload"?
Problem 2: I an unable to find any unique IDs for selecting "ROUND", So I am unable to manipulate this for TEAMS or PLAYERS. (I haven't a clue how to work around this)
Problem 3: Once I am able to manipulate "SEASON", "PLAYERS" and "ROUND", I am interested in manipulating "Advanced Options" (I haven't looked at this yet)
Problem 4: After "Advanced Options" I want to extract the data to excel. (I haven't looked at this yet)
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "http://www.afl.com.au/stats"
IE.Visible = True
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE And Not IE.Busy
IE.document.getElementById("stats_tab").getElementsByTagName("a")(1).Click
'clicks on "players" box
IE.document.getElementById("stats-team-stats").getElementsByTagName("option")(0).removeAttribute("selected") = "true"
IE.document.getElementById("stats-team-stats").getElementsByTagName("option")(2).setAttribute("selected") = "true"
'dropdown box un-selects 2017 and then selects 2015 team stats, but data for 2015 does not load!!
IE.document.getElementById("stats-player-stats").getElementsByTagName("option")(0).removeAttribute("selected") = "true"
IE.document.getElementById("stats-player-stats").getElementsByTagName("option")(2).setAttribute("selected") = "true"
'dropdown box un-selects 2017 and then selects 2015 team stats, but data for 2015 does not load!!
Thanks guys!
Jimmy
Bookmarks