Segue o código:
Código: Selecionar todos
Sub teste2()
Dim ht As HTMLDocument
Dim IE As Object
Dim btn As HTMLButtonElement
Dim objLink As Object
Dim objLink1 As Object
Dim ele As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.navigate ("http://estatisticas.cetip.com.br/astec/series_v05/paginas/web_v04_10_01_estoque.asp?str_Ativo=CFF&str_TipoInformacao=Negociações Definitivas&str_TipoInformacaoModelo=0&int_Idioma=1")
While .Busy Or .readyState <> 4:
DoEvents:
Wend
For Each objLink In IE.document.getElementsByTagName("a")
If objLink.href = ("javascript:void(0);") Then
objLink.Click
Exit For
End If
Next objLink
With IE
While .Busy Or .readyState <> 4: DoEvents: Wend
For i = 1 To 2
SendKeys "DEB"
'While .Busy Or .readyState <> 4: DoEvents: Wend
Application.Wait (Now + TimeValue("0:00:02"))
Next i
SendKeys "Negociações D"
While .Busy Or .readyState <> 4: DoEvents: Wend
''''' A partir daqui a macro não executa o código que faz rigorosamente a mesma coisa que o getElements antes do SendKeys.
With IE
For Each objLink1 In IE.document.getElementsByClassName("bt-padrao mt-35")
If objLink1.href = ("javascript:Fun_EnvioChecaDados(1,'F1')") > 0 Then
objLink1.Click
Exit For
End If
Next objLink1
End With
End With
End With
End Sub
Séries Históricas -> Dados por ativo -> Escolhe o Ativo -> Informações -> E então quer pesquisar, que abre uma nova aba com os dados