VBA IE Button Issue

Zring

New Member
Joined
Jan 21, 2018
Messages
3
Hi Everyone,

I am hoping that you can help me with this issue. I am trying to automate getting onto a website and clicking a button. Thus far, I have not been able to determine where the issue is.
________________________________
Sub Test()Dim oHTML_Element As IHTMLElement
Dim oBrowser As InternetExplorer
Dim ie As Variant
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "Website goes here"
While ie.ReadyState <> READYSTATE_COMPLETE And ie.ReadyState <> READYSTATE_LOADED
DoEvents
Wend
For Each oHTML_Element In ie.Document.getElementsById("WD2A")
oHTML_Element.Click
Next
End Sub
______________________
I am getting a runtime error 438: Object doesn't support this property or method.

The HTML code for the button is as follows:

<a tabIndex="0" title="Click here" class="lsControl--Valign urLnkFunction ur TxtEmph LsTextNoWrapping" id="WD2A" style="WHITE-SPACE: nowrap" ondragstart="var e=window.event;e.cancelBubble=true;e.returnValue=false;return false;"href="javascript:void(0);" shape="" ct="LN" ti="0" lsevents="{Activate: [{ResponseDate:'delta',ClientAction:'submit'},{}]}"


Please advise.

Thank you,
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Finally, here is the button code from the website.

ondragstart="var
e=window.event;e.cancelBubble=true;e.returnValue=false;return false;" tabIndex=0
id=WD2A title="Click here" class="lsControl--valign
urLnkFunction urTxtEmph lsTextNoWrapping" style="WHITE-SPACE:
nowrap" href="javascript:void(0);" ct="LN"
ti="0" lsevents="{Activate:[{ResponseData:'delta',ClientAction:'submit'},{}]}"
src="link to picture button" align=absMiddle>
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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