早上好!我正在开发一个宏来单击页面上的几个按钮,但有些按钮不起作用。有谁知道为什么?
我将我的工作表发布在:http ://www.sendspace.com/file/3if8c6
提前感谢您的帮助。
西尔玛
早上好!我正在开发一个宏来单击页面上的几个按钮,但有些按钮不起作用。有谁知道为什么?
我将我的工作表发布在:http ://www.sendspace.com/file/3if8c6
提前感谢您的帮助。
西尔玛
在电子表格中,我发布了一张带有无法点击的 02 按钮的图片。无论如何,我会在这里发布代码。
谢谢!
Sub test()
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
' The error happens here
' 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