2
I’m having a problem to automate downloading data from a site using VBA. The first part goes well, the browser enters the desired page and inserts the criteria into a dropdown list. Just click on the search button, but the macro to not appear a debug or anything.
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 objLink In ie.document.getElementsByTagName("a")
If objLink.href = ("http://estatisticas.cetip.com.br/astec/series_v05/paginas/web_v04_10_03_consulta.asp") Then
objLink.Click
Exit For
End If
Next objLink
End With
End With
End Sub
Do you really need to use VBA for this? I ask because there are many good frameworks for this type of automation (type Selenium, Watin, Capybara, Casperjs) mainly for testing.
– sergiopereira