Good morning! I am developing a macro to click a few buttons on a page, but some are not working. Does anyone know why?
CLICAR BOTOES PAGINA.zip
Thanks in advance for any help.![]()
Sub teste() Dim ie Dim obj Dim obj2 Dim linkCollection2 Dim elemCollection Dim t As Integer Dim r As Integer, c As Integer Set ie = CreateObject("internetexplorer.application") ie.Navigate2 "http://www.infomoney.com.br/mercados/agendas" ie.Visible = True Do While ie.Busy Loop Do Until ie.Document.ReadyState = "complete" Loop Dim LinkFound As Boolean Dim linkCollection Set linkCollection = ie.Document.getElementsByTagName("A") For Each link In linkCollection If link.InnerText = "Resultados" Then LinkFound = True link.Click Exit For End If Next If Not LinkFound Then MsgBox "Link Not Found!" Exit Sub End If Do While ie.Busy Loop Do Until ie.Document.ReadyState = "complete" Loop For Each obj In ie.Document.All.Item("ctl00$cphContent$ctl02$ddlReferencePage").Options If obj.InnerText = "3T12" Then obj.Selected = True ' ie.Document.forms(0).submit Exit For End If Next obj Set linkCollection2 = ie.Document.getElementsByTagName("A") For Each link In linkCollection2 If link.InnerText = "Resultados" Then LinkFound = True link.Click Exit For End If Next Set elemCollection = ie.Document.getElementsByTagName("TABLE") For t = 0 To elemCollection.Length - 1 For r = 0 To elemCollection(t).Rows.Length - 1 For c = 0 To elemCollection(t).Rows(r).Cells.Length - 1 ThisWorkbook.Worksheets(1).Cells(r + 1, c + 1) = elemCollection(t).Rows(r).Cells(c).InnerText Next c Next r Next t ' TO FROM HERE DOES NOT WORK. WHY? For Each obj2 In ie.Document.All.Item("tblCInvestorData_length").Options If obj.InnerText = "100" Then obj2.Selected = True ' ie.Document.forms(0).submit Exit For End If Next obj2 End Sub
Silmar











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks