VBA IE to click on button inside a table

RodrigoFinguer

Board Regular
Joined
Jun 13, 2017
Messages
75
HTML:
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr>
<td style="width: 1%;">
<img alt="" src="/an/919858511/p/Ariba/hdr_Ariba_Discovery_2x.png" height="30" border="0">
</td>
<td style="padding:4px 20px 0px 0px;white-space:nowrap;text-align:right;text-align:right;vertical-align:top;" width="100%">
<span class="ADLinkWhite">
<a id="_o5jjl" href="#" bh="HL" _sf="false">
<b>Associe-se ao Ariba Discovery</b></a>
<img alt="" src="/an/919858511/p/Ariba/img_hdr_tooNav_divider_2x12.gif" name="commandDivider" class="disc-ADCBL-adCmdBarLinkImg" border="0">
<a id="_oz1ye" href="#" bh="HL" _sf="false">
Feedback
</a>
<img alt="" src="/an/919858511/p/Ariba/img_hdr_tooNav_divider_2x12.gif" name="commandDivider" style="margin-bottom:-2px" border="0">
<span style="margin-right:10px">
<div class="rr" id="_odjpnb"><a class="leg-txt-dec-none" xclick="javascript:ariba.Community.gotoCommunityWithContext('https://uex.ariba.com/?q=external-login&a_persona=seller&a_context=discovery&a_domn=aribanetwork&a_lgin=false&a_lang=pt_BR&a_enc=EncodeBase64','scrollbars=yes, status=yes, resizable=yes, location=yes, toolbar=yes, width=920, height=675');;" href="javascript:void(0);">
Ajuda
</a></div>
</span>
<img alt="" src="/an/919858511/p/Ariba/img_hdr_tooNav_divider_2x12.gif" name="commandDivider" style="margin-left:-10px;margin-bottom:-2px" border="0">
<div class="rr" id="_sauytd"><a id="_1xvdab" href="#" bh="HL" _sf="false" style="">Acessar</a></div>
</span>
</td>
</tr>
</tbody></table>

Hello guys,

I need to click on the div href button called "Acessar", but I have already tried everything and nothing worked.
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Since you have the ID for the desired anchor element, you can use the getElementById method of the HTML Document object. For example, let's say that you've assigned the HTML document to an object variable called "HTMLDoc", you would do the following...

Code:
HTMLDoc.getElementById("_1xvdab").click

Hope this helps!
 
Upvote 0
Since you have the ID for the desired anchor element, you can use the getElementById method of the HTML Document object. For example, let's say that you've assigned the HTML document to an object variable called "HTMLDoc", you would do the following...

Code:
HTMLDoc.getElementById("_1xvdab").click

Hope this helps!

Sorry, nothing happens, I have already tried this option. This is my code so far:

Code:
Sub Automate_IE_Load_Page()
'This will load a webpage in IE
    Dim URL As String
    
    Dim linhas As Single
    Dim allHREFs As New Collection
    Dim IE As Object
    Dim HTMLDoc As HTMLDocument
    Dim Element As Object
    
    
     Set IE = New InternetExplorer
     IE.Visible = True
 
 
    'Define URL
    URL = "https://service.ariba.com/Discovery.aw/125002042/aw?awh=r&awssk=c5azYMs_&dard=1"
 
    'Navigate to URL
    IE.Navigate URL
 
    ' Statusbar let's user know website is loading
    Application.StatusBar = URL & " is loading. Please wait..."
 
    ' Wait while IE loading...
    Do While IE.Busy = True
        Application.Wait DateAdd("s", 1, Now)
    Loop
    
 
    'Webpage Loaded
    Application.StatusBar = URL & " Loaded"
    Set HTMLDoc = IE.Document
    VBA.AppActivate IE.Document.Title & " - " & IE.Name, 0
   
    HTMLDoc.getElementById("_1xvdab").Click
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top