PDA

View Full Version : Unable to click on button HTML



Svmaxcel
09-03-2017, 07:15 PM
Hi, I am making a VBA code to open a site to get some data and need help.

Its a intranet site
The site has a certifical error, so every time we open the site, we have to click on proceed to site anyway.

The site then have a agree button for terms and conditions.

Code I used is as below.
Ms internet controls and ms HTML references are added.



Dim ie as new shwdoc.internetexplorer
Dim htmldoc as mshtml.htmldocument
Dim htmlinput as mshtml.ihtmlelement

ie.visible = true
is.navigate "site name"

Do while readystate <> readystate complete
Loop

Set htmldoc = ie.document

'For clicking proceed to site
Set htmlinput = htmldoc.getelementbyid("override")
htmlinput.Click

'For clicking I Agree
Set htmlinput = htmldoc.getelementbyid("btnagree")
htmlinput.Click

End sub


When I run this, a new ie opens and I am directed to I Agree page, which means proceed to site is working.
But for some reason its not able to click on I Agree

Please help


https://www.pastiebin.com/5968e5e74510c
HTML code of website.
Cross post : https://chandoo.org/forum/threads/web-vba-issue.35060/#post-210804