1
Hi, I’m new around here, I am facing a problem with my VBA code, I am trying an interaction using the internet explore, I need you to do the following steps
- access the site: https://www.bcb.gov.br/estabilidadefinanceira/historicocotacoes
- select the radio button 2 <"Closing quotations of all currencies in a date.">
- click search.
however, when I try to teach the radio button, it appears an error. below is my code.
Sub buscador()
Set ie = CreateObject("InternetExplorer.application")
ie.navigate "https://www.bcb.gov.br/estabilidadefinanceira/historicocotacoes"
ie.Visible = True
Do While ie.Busy And ie.readyState <> ""
DoEvents
Loop
ie.document.getElementById("RadOpcao").Item(1).Click
ie.document.getElementsByClassName("fundoPadraoBClaro3").Item(0).getElementsByTagName("input").Item(1).Click
End Sub
HTML I’m taking the classes

getElementByIdas it says the method name picks up an element, so you don’t need the.Itempq will not return an array but a single object– Ricardo Pontual
@Ricardopunctual I tested with the following expression ie.document.getelementsbytagname("Radopcao")(0). Click however failed, gave error 91
– Pedro souza
I believe you don’t know much about html, I think you need to take a look at :)
getElementsByTagNamewill look for a tag as the method name says, I do not know a "Radopcao" tag in html :) this method is used for "input", "button", "div", etc– Ricardo Pontual