1

I've been trying many codes to click the right button and open the page to scrape the data.

I was able to have the form filled and then click on submit, but the second part I can't seem to put to work. I want it to click on the href with has the same name that I searched on the form

enter image description here

Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer

Sub CETIP()

Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear
   sURL = "https://www2.cetip.com.br/TitulosCRI"
Set oBrowser = New InternetExplorer
   oBrowser.Silent = True
   oBrowser.timeout = 60
   oBrowser.Navigate sURL
   oBrowser.Visible = True

Do
Loop Until oBrowser.ReadyState = READYSTATE_COMPLETE

Set HTMLDoc = oBrowser.document
  HTMLDoc.all.ddlCodigoIF.Value = "08L0002118"


For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
    If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For

Next
Err_Clear:

Resume Next
 
End Sub
Dharman
  • 30,962
  • 25
  • 85
  • 135

0 Answers0