我有一个代码,可以在网站上为用户进行研究,然后从该研究中获取信息。 在获取信息的过程中,我需要点击网站内的链接。每次用户进行不同的研究时,此链接都可以更改,因此我无法使用它的href来访问它。我不知道该怎么做。
这是我的代码,直到现在:它一直持续到链接所在的网页。 代码的步骤:
以下是代码:
Sub teses2()
Dim pesquisa As String
Dim ie As InternetExplorer
Dim elemns As Object
Dim elem As Object
Dim elemns2 As Object
Dim elem2 As Object
Dim elem3 As Object
Dim obj As Object
pesquisa = InputBox("Digite os termos que quer pesquisar: ", "", "")
Set ie = New InternetExplorer
ie.Visible = True
ie.navigate "http://www.stj.jus.br/SCON/"
Application.Wait (Now + TimeSerial(0, 0, 20))
ie.document.getElementById("pesquisaLivre").innerText = pesquisa
Set elemns2 = ie.document.getElementsByTagName("input")
For Each elem2 In elemns2
If elem2.Value = "SUMU" Then
elem2.Click
End If
If elem2.Value = "DTXT" Then
elem2.Click
End If
If elem2.Value = "INFJ" Then
elem2.Click
End If
Next
Set elemns = ie.document.getElementsByTagName("input")
For Each elem In elemns
If elem.Value = "Pesquisar" Then
elem.Click
End If
Next
End Sub
答案 0 :(得分:1)
我重新审视了这一点并使其更加严格。
=INDEX(Sheet2!$1:$1048576,MATCH(Sheet1!B2,Sheet2!A:A,0),MATCH("Color",Sheet2!$1:$1,0))