Galera, bom dia.
Estou tentando marcar um rádio button no IE com VBA, mas dá o erro em tempo de execução 424 - O objeto é obrigatório.
Esta é a página: "http://www.gnre.pe.gov.br/gnre/v/guia/index"
Alguém pode me dar uma força, por favor?
O objetivo é marcar o radio button e fazer com que a página abra o próximo passo, como se o preenchimento fosse manual.
Segue meu código VBA:
Código: Selecionar todos
Sub emiteGNRE()
Dim Ie As Object
Dim iURL As String
iURL = "http://www.gnre.pe.gov.br/gnre/v/guia/index"
Set Ie = CreateObject("InternetExplorer.Application")
Ie.Visible = True
Ie.Navigate iURL
While Ie.ReadyState <> READYSTATE_COMPLETE
Wend
Application.Wait Now + TimeValue("00:00:03")
Ie.Document.getElementById("ufFavorecida").Value = "RN"
Ie.Document.forms("form").submit
While Ie.ReadyState <> READYSTATE_COMPLETE
Wend
Application.Wait Now + TimeValue("00:00:03")
'Aqui o erro acontece
Ie.Document.getElementById("optGnreSimples").Checked = True
'Formas já tentadas:
'Ie.Document.getElementById("optGnreSimples").SelectedItem = 1
'Ie.Document.getElementById("optGnreSimples").Item(0).Checked = True
'Ie.Document.getElementById("optGnreSimples").Item(1).Checked = True
Set Ie = Nothing
End Sub
Código: Selecionar todos
<form action="" method="post" id="form">
<input type="hidden" name="gnre.versao" value="2.00">
<input type="hidden" name="gnre.dadosGnre" value="DadosGnre_v2_00">
<input type="hidden" name="gnre.dadosGnre.ufFavorecida" id="hdUfFavorecida" value="RN">
<fieldset id="fsTipoGnre" style="">
<legend>Selecione o tipo de GNRE</legend>
<div>
<span title="Esta GNRE ..." class="tooltip">
<!-- Abaixo o elemento que preciso marcar: -->
<input type="radio" name="gnre.dadosGnre.tipoGnre" id="optGnreSimples" value="0"><span>GNRE Simples</span>
</span>
</div>
</fieldset>
<div "..."</div>
<div "..."</div>
<div "...">
<input "...">
<input "...">
<input "...">
</div>
</form>