excel - VBA Web Automation -
i'm trying write macro access data web portal, need launch website , click 'open in excel' button.
i've launched webpage fine, can't not click link. understanding should able similar this:
browswerobject.document.elementid.click
but i'm not sure correct element , coding be. 1 webpage when inspect element has code:
<a onclick=ur_button_click(event); tabindex=0 id=button_toolbar_standard_btn7_acbutton title="open in excel" class=urbtnstd onkeydown=ur_button_keypress(event); style="overflow: visible; text-align: center" href="javascript:void(0);" ct="b" ti="0" st="" ocl="sapbi_page.sendcommandarray([['guid','11',0],['nouilock','x',0],['bi_command_type','abstract',0]],event);">open in excel</a>
could pinpoint should focus on this?
edit: i've tried getelementbyid i'm running in error: method ‘document’ of object ‘iwebbrowser2’ failed
by sample code is:
dim ie object set ie = createobject("internetexplorer.application") ie.visible = true ie.navigate *link* ie.document.getelementbyid("button_toolbar_standard_btn7_acbutton ").click
you right, should . . .
for each ohtml_element in htmldoc.getelementsbytagname("input") if ohtml_element.type = "submit" ohtml_element.click: exit next
read more @ http://vbadud.blogspot.com/2009/08/how-to-login-to-website-using-vba.html#gurmexg3kmwvfumx.99
the best way see id name of button hit f12 when on site. if use firefox , f12 nothing, download firebug.
https://addons.mozilla.org/en-us/firefox/addon/firebug/
if use ie , nothing happens when hit f12, download , install ie developer tool.
https://msdn.microsoft.com/en-us/library/bg182326(v=vs.85).aspx
these tools allow see code behind page , highly interactive too, these things easy use.
good luck!!
Comments
Post a Comment