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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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