I cannot access IE checkbox element by vba

Asked

Viewed 249 times

1

I’m trying to click a checkbox by IE, using VBA, but I can’t access the element of this checkbox.

I searched through several different forums and the closest I could find was that access to a part of the tree might not be allowed.

The site is: "http://www.bmfbovespa.com.br/pt_br/servicos/market-data/historico/mercado-de-derivativos/pesquisa-por-pregao/"

The checkbox is: input type="checkbox" id="chkArquivoDownload23_active" name="chkArquivoDownload_active" value="23" onclick="processSelecaoFile(Event, this, '_active');" class="Stock Market - Delta Volatility Surface for Stock Options" Aria-invalid="false"

Follows my code:

Sub download_IE()

Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")

IE.Visible = True
IE.Navigate "http://www.bmfbovespa.com.br/pt_br/servicos/market-
data/historico/mercado-de-derivativos/pesquisa-por-pregao/"

Do While IE.Busy: DoEvents: Loop
Do While IE.ReadyState <> 4: DoEvents: Loop

Dim elems As Object, e As Object


Set elems = IE.document.getelementsbytagname("iframe")
(0).contentWindow.document.getelementsbytagname("input")

For Each e In elems
    If e.getAttribute("id") = "chkArquivoDownload23_ativo" Then
        e.Click
    End If
Next e

End Sub
  • =] do not forget to mark as response

  • Hector, I saw that you became a member of the community today, just below the rating of the answer, has a V to mark it as the answer to your question. Please mark it. Thank you

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.