excel VBA - Macro to click to the next page in IE -
i cannot figure out how click "next 100" button on page:
specifically section:
<form> <table border="0" width="100%"> <tbody><tr> <td>items 1 - 100 <a href="/cgi-bin/browse-edgar?action=getcompany&cik=0000898293&type=&dateb=&owner=exclude&start=0&count=100&output=atom"><img src="/images/rss-feed-icon-14x14.png" alt="0000898293 filings" border="0" align="top"> rss feed</a></td> <td style="text-align: right;"> <input type="button" value="next 100" onclick="parent.location='/cgi-bin/browse-edgar?action=getcompany&cik=0000898293&type=&dateb=&owner=exclude&start=100&count=100'"></td> </tr> </tbody></table> </form>
below have tired in excel vba, don't have strong understanding of , know how click button if can see element id.
sub dates()dim ie new internetexplorer ie.visible = true ie.navigate "http://www.sec.gov/cgi-bin/browse-edgar?cik=jbl&owner=exclude&action=getcompany" doevents loop until ie.readystate = readystate_complete dim doc htmldocument set doc = ie.document doc.getelementbyid("count").value = 100 doc.forms.item(0).submit dim objtag object each objtag in doc.getelementsbytagname(strtagname) if instr(objtag.outerhtml, "next 100") > 0 objtag.click objtag.fireevent ("onclick") exit end if next
this should work you:
sub dates() dim ie new internetexplorer set ie = createobject("internetexplorer.application") ie.visible = true ie.navigate "http://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&cik=0000898293&type=&dateb=&owner=exclude&count=100" doevents loop until ie.readystate = readystate_complete ie.document set elems = .getelementsbytagname("input") each e in elems if e.type = "button" , e.value = "next 100" e.click exit end if next e end end sub
if using following link :
http://www.sec.gov/cgi-bin/browse-edgar?cik=jbl&owner=exclude&action=getcompany
you'll have check for
if objcollection(i).type = "button" , objcollection(i).value = "next 40"