I'm trying to write a macro to access data from a web portal, where I need to launch the website and click an 'open in excel' button.
I've launched the webpage fine, but I can't not click the link. My understanding is I should be able to do something similar to this:
BrowswerObject.Document.ElementID.Click
but I'm not sure what the correct element and coding would be. One the webpage when I inspect the element it has this 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 anyone pinpoint what from that I should focus on for this?
Edit: I've tried the getElementByID but I'm running in to this error: Method ‘Document’ of object ‘IWebBrowser2’ failed
by sample code is:
Dim ie As Object
Set ie = CreateObject("Internetexplorer.Application")
ie.Visible = True
ie.Navigate *Link*
ie.document.getElementById("BUTTON_TOOLBAR_STANDARD_btn7_acButton ").Click

Dim ie as SHDocVw.InternetExplorer: set ie = new SHDocVw.InternetExplorerrather than using genericObject. (2) Use aNavigateErrorevent to see ifNavigateactually succeeds. (3) In the VB editor, set a breakpoint on thegetElementByIdline and use the Watch window to see ifie.Documentis actually a valid Object when you try to callgetElementById..Navigateuntill IE is not busy, docunent is ready and target element is not null.