Hi
I am trying to click on a button on an internet page. This page holds 15 different reports that needs to be downloaded every week and is taking about 10 minutes to download one by one.
below is the inspect element. and the code I have been trying. I am able to logon and sign in using username and password. however unable to click on the Extract reports button.
I would really appreciate a code to let me click this button.
Code
Sub Download()
' Download Macro
Dim MyHTML_Element As IHTMLElement
Dim Myurl As String
On Error GoTo Err_Clean
Myurl = "[URL]https://roymorgan.com[/URL]"
Set MyBrowser = New InternetExplorer
MyBrowser.silent = True
MyBrowser.navigate Myurl
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readtstate = readystate_Complere
Set htmldoc = MyBrowser.document
htmldoc.all.UserName.Value = "[EMAIL="[email protected]"][email protected][/EMAIL]"
htmldoc.all.Password.Value = "......."
If objIE.document.getElementsByClassName("Login-button") Then MyHTML_Element.Click
For Each MyHTML_Element In htmldoc.getElementsByTagName("Input")
If MyHTML_Element.Type = "Login-button" Then MyHTML_Element.Click: Exit For
Next
Err_Clean:
If Err <> 0 Then
Err.Clear
Resume Next
Set objIE = CreateObject("InternetExplorer.Application")
'objIE.getElementById("toggleExpand").selectedIndex = 1
objIE.document.getElementsByClassName("toggleexpand").Click
End If
'
End Sub
Display More