ibnpinto
Membros-
Total de itens
1 -
Registro em
-
Última visita
Sobre ibnpinto
ibnpinto's Achievements
0
Reputação
-
ibnpinto se registrou na comunidade
-
Quando rodo o código no depurador ele opera tudo certo, quando utilizo no botão no Excel ele da o erro. Durante meu código eu abro a Internet Explorer, acesso um site, realizo o login..... quando vou acessar um novo site ele aparece erro de recurso em uso, segue abaixo o código e em vermelho a parte do erro: Sub ColetarDados() Dim ie As Object Dim dado As String Dim HTMLDoc As HTMLDocument Dim oHTML_Element As IHTMLElement Set ie = CreateObject("internetexplorer.application") ie.Visible = True ie.navigate "http://siacweb.com.br" Do Loop Until ie.ReadyState = READYSTATE_COMPLETE Set HTMLDoc = ie.Document HTMLDoc.all.Login.Value = "LOGIN" HTMLDoc.all.senha.Value = "SENHA" For Each oHTML_Element In HTMLDoc.getElementsByTagName("input") If oHTML_Element.ID = "btn_submit" Then oHTML_Element.Click: Exit For Next MsgBox ("Login efetuado, acessando balanço.") ie.navigate "http://siacweb.com.br/relatorio_balanco.php?tipo=1" Do Loop Until ie.ReadyState = READYSTATE_COMPLETE datainicial = Str(Range("K8")) datafinal = Str(Range("K9")) HTMLDoc.all.datainicial.Value = datainicial HTMLDoc.all.datafinal.Value = datafinal For Each oHTML_Element In HTMLDoc.getElementsByTagName("input") If oHTML_Element.Type = "image" Then oHTML_Element.Click: Exit For Next End Sub