Hi All,
I am trying to work on a Macro to login into a website and then download some data. Currently I am having trouble getting it to click on a link in the site.
Code:
Here's the html code from the site:
I would like to change the class which state the selected (or unselected) of the "option" element, any idea?
I am trying to work on a Macro to login into a website and then download some data. Currently I am having trouble getting it to click on a link in the site.
Code:
VBA Code:
Sub GetHTLMDocuments()
Dim IE As New SHDocVw.InternetExplorerMedium
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
Dim HTMLButtons As MSHTML.IHTMLElementCollection
Dim HTMLButton As MSHTML.IHTMLElement
IE.Visible = True
IE.navigate "xxx.yyy"
Do While IE.readyState <> READYSTATE_COMPLETE
Application.Wait Now + TimeValue("00:00:03")
DoEvents
Loop
Application.Wait Now + TimeValue("00:00:02")
ShowWindow IE.hwnd, SW_MAXIMIZE
Set HTMLDoc = IE.document
Application.Wait Now + TimeValue("00:00:02")
Set ElementCol = IE.document.getElementById("periods")
For Each btnInput In ElementCol
If btnInput.Value = "selected" Then
btnInput.Click
Exit For
End If
Next btnInput
IE.Quit
End Sub
Here's the html code from the site:
I would like to change the class which state the selected (or unselected) of the "option" element, any idea?