Problems to click links / buttons in IE using VBA

2

I have a problem to automate the download of 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 need to click on the search button, but the macro to without appearing 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
    
asked by anonymous 25.09.2015 / 20:25

1 answer

-1

Use the html.parentWindow.execScript (" comando click em java")

    
15.04.2016 / 20:04