html - VBA to click a button on a website and extract tables -
i want click button on website vba , extract table appears when clicked.
my code here not working right now, how can that?
i want click "get price quoted" button on right corner of table , extract appearing information.
sub test() dim ie object dim doc object dim strurl string dim objelement object dim objcollection object strurl = "http://financials.morningstar.com/competitors/industry-peer.action?t=goog®ion=usa&culture=en-us" set ie = createobject("internetexplorer.application") ie .visible = true .navigate strurl until .readystate = 4: doevents: loop while .busy: doevents: loop dim item object set item = ie.document.getelementsbyclassname("hspacer0") item.item(0).click until .readystate = 4: doevents: loop while .busy: doevents: loop set doc = ie.document getalltables6 doc .quit end end sub
you not clicking correct button code. not sure button if clicking. if run javascript code loadindustrypeersquotedata(1) 'click' button , need code getting table.
that 'hspacer0' blank spacer contains no objects or click.