Vídeo recomendado
https://youtu.be/diWPPPhW-9E
https://youtu.be/diWPPPhW-9E
Erro no código de pesquisa
Erro no código de pesquisa
Bom dia!
Alguém poderia me ajuda? não estou conseguindo puxar os dados da Web de uma pesquisa já finalizada, fiz o código de pesquisa automatizada, mas não consigo puxar os dados, eu quero apenas o valor!
Obs: O código enter " Application.SendKeys "~", True" está com erro, seria outro ponto que preciso de ajuda!
-----------
Sub Cotação()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
IE.Document.getElementById("select_data").Value = ("22/09/2019")
IE.Document.getElementById("input_cotacao").Value = ("GIG")
IE.Document.getElementById("input_destino").Value = ("PMW")
IE.Document.getElementById("input_cotacao_2").Value = ("1")
IE.Document.getElementById("input_destino_1").Value = ("77730")
IE.Document.getElementById("select_produto").Value = ("GDS")
IE.Document.getElementById("input_entrega").Click
IE.Document.getElementById("quote").Click
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
On Error GoTo Invalido
IE.Document.getElementById("input_name").Value = ("Marcos")
IE.Document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.Document.getElementById("input_email").Value = ("marcos.abreu@gmail.com.br")
IE.Document.getElementById("input_company").Value = ("Marcos Patricio")
Application.SendKeys "~", True
Invalido:
End With
End Sub
Alguém poderia me ajuda? não estou conseguindo puxar os dados da Web de uma pesquisa já finalizada, fiz o código de pesquisa automatizada, mas não consigo puxar os dados, eu quero apenas o valor!
Obs: O código enter " Application.SendKeys "~", True" está com erro, seria outro ponto que preciso de ajuda!
-----------
Sub Cotação()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
IE.Document.getElementById("select_data").Value = ("22/09/2019")
IE.Document.getElementById("input_cotacao").Value = ("GIG")
IE.Document.getElementById("input_destino").Value = ("PMW")
IE.Document.getElementById("input_cotacao_2").Value = ("1")
IE.Document.getElementById("input_destino_1").Value = ("77730")
IE.Document.getElementById("select_produto").Value = ("GDS")
IE.Document.getElementById("input_entrega").Click
IE.Document.getElementById("quote").Click
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
On Error GoTo Invalido
IE.Document.getElementById("input_name").Value = ("Marcos")
IE.Document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.Document.getElementById("input_email").Value = ("marcos.abreu@gmail.com.br")
IE.Document.getElementById("input_company").Value = ("Marcos Patricio")
Application.SendKeys "~", True
Invalido:
End With
End Sub
-
- Manda bem
- Mensagens: 127
- Registrado em: Sex Out 05, 2018 2:42 pm
Re: Erro no código de pesquisa
Olá amigo,
Para o segundo botão funcionar.
Application.SendKeys "~", True
Mude para
IE.Document.getElementById("Cadastrar").Value = Button.Click
Estou na correria mas vou tentar em outro momento dar uma olhada para puxar as informações.
Abraço
Para o segundo botão funcionar.
Application.SendKeys "~", True
Mude para
IE.Document.getElementById("Cadastrar").Value = Button.Click
Estou na correria mas vou tentar em outro momento dar uma olhada para puxar as informações.
Abraço
Re: Erro no código de pesquisa
Muito Obrigado!!!
Se conseguir me ajudar a puxar os dados (em especifico o valor da cotação), eu ficarei bastante agradecido!
Se conseguir me ajudar a puxar os dados (em especifico o valor da cotação), eu ficarei bastante agradecido!
Re: Erro no código de pesquisa
Amigo, esse código --- IE.Document.getElementById("Cadastrar").Value = Button.Click ---- não está funcionando, ele nao da erro, mas nao acontece nada tb!Julio Mangilli escreveu: ↑Seg Set 23, 2019 9:06 am Olá amigo,
Para o segundo botão funcionar.
Application.SendKeys "~", True
Mude para
IE.Document.getElementById("Cadastrar").Value = Button.Click
Estou na correria mas vou tentar em outro momento dar uma olhada para puxar as informações.
Abraço
-
- Manda bem
- Mensagens: 127
- Registrado em: Sex Out 05, 2018 2:42 pm
Re: Erro no código de pesquisa
Opa, serio? Bom tentamos assim agora então amigo.
Sub Cotação()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
IE.document.getElementById("select_data").Value = ("22/09/2019")
IE.document.getElementById("input_cotacao").Value = ("GIG")
IE.document.getElementById("input_destino").Value = ("PMW")
IE.document.getElementById("input_cotacao_2").Value = ("1")
IE.document.getElementById("input_destino_1").Value = ("77730")
IE.document.getElementById("select_produto").Value = ("GDS")
IE.document.getElementById("input_entrega").Click
IE.document.getElementById("quote").Click
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
On Error GoTo Invalido
IE.document.getElementById("input_name").Value = ("Marcos")
IE.document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.document.getElementById("input_email").Value = ("marcos.abreu@spharmu.com.br")
IE.document.getElementById("input_company").Value = ("SPecial Pharmus")
Dim objElementCol As Object
Dim objElement As Object
Set objElementCol = IE.document.getElementsByTagName("input")
For Each objElement In objElementCol
If objElement.Value = "Cadastrar" Then
objElement.Click
Exit For
End If
Next objElement
Invalido:
End With
End Sub
Sub Cotação()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
IE.document.getElementById("select_data").Value = ("22/09/2019")
IE.document.getElementById("input_cotacao").Value = ("GIG")
IE.document.getElementById("input_destino").Value = ("PMW")
IE.document.getElementById("input_cotacao_2").Value = ("1")
IE.document.getElementById("input_destino_1").Value = ("77730")
IE.document.getElementById("select_produto").Value = ("GDS")
IE.document.getElementById("input_entrega").Click
IE.document.getElementById("quote").Click
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend
On Error GoTo Invalido
IE.document.getElementById("input_name").Value = ("Marcos")
IE.document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.document.getElementById("input_email").Value = ("marcos.abreu@spharmu.com.br")
IE.document.getElementById("input_company").Value = ("SPecial Pharmus")
Dim objElementCol As Object
Dim objElement As Object
Set objElementCol = IE.document.getElementsByTagName("input")
For Each objElement In objElementCol
If objElement.Value = "Cadastrar" Then
objElement.Click
Exit For
End If
Next objElement
Invalido:
End With
End Sub
-
- Manda bem
- Mensagens: 127
- Registrado em: Sex Out 05, 2018 2:42 pm
Re: Erro no código de pesquisa
Sobre a questão do botão click
segue, aqui funcionou
Sub Cotação()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now) + 1)
DoEvents:
Wend
IE.Document.getElementById("select_data").Value = ("22/09/2019")
IE.Document.getElementById("input_cotacao").Value = ("GIG")
IE.Document.getElementById("input_destino").Value = ("PMW")
IE.Document.getElementById("input_cotacao_2").Value = ("1")
IE.Document.getElementById("input_destino_1").Value = ("77730")
IE.Document.getElementById("select_produto").Value = ("GDS")
IE.Document.getElementById("input_entrega").Click
IE.Document.getElementById("quote").Click
While .Busy Or .ReadyState <> 4:
Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now) + 1)
DoEvents:
Wend
On Error GoTo Invalido
IE.Document.getElementById("input_name").Value = ("Marcos")
IE.Document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.Document.getElementById("input_email").Value = ("marcos.abreu@spharmu.com.br")
IE.Document.getElementById("input_company").Value = ("SPecial Pharmus")
Dim objElementCol As Object
Dim objElement As Object
Set objElementCol = IE.Document.getElementsByTagName("input")
For Each objElement In objElementCol
If objElement.Value = "Cadastrar" Then
objElement.Click
Exit For
End If
Next objElement
Invalido:
End With
End Sub
segue, aqui funcionou
Sub Cotação()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now) + 1)
DoEvents:
Wend
IE.Document.getElementById("select_data").Value = ("22/09/2019")
IE.Document.getElementById("input_cotacao").Value = ("GIG")
IE.Document.getElementById("input_destino").Value = ("PMW")
IE.Document.getElementById("input_cotacao_2").Value = ("1")
IE.Document.getElementById("input_destino_1").Value = ("77730")
IE.Document.getElementById("select_produto").Value = ("GDS")
IE.Document.getElementById("input_entrega").Click
IE.Document.getElementById("quote").Click
While .Busy Or .ReadyState <> 4:
Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now) + 1)
DoEvents:
Wend
On Error GoTo Invalido
IE.Document.getElementById("input_name").Value = ("Marcos")
IE.Document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.Document.getElementById("input_email").Value = ("marcos.abreu@spharmu.com.br")
IE.Document.getElementById("input_company").Value = ("SPecial Pharmus")
Dim objElementCol As Object
Dim objElement As Object
Set objElementCol = IE.Document.getElementsByTagName("input")
For Each objElement In objElementCol
If objElement.Value = "Cadastrar" Then
objElement.Click
Exit For
End If
Next objElement
Invalido:
End With
End Sub
-
- Manda bem
- Mensagens: 127
- Registrado em: Sex Out 05, 2018 2:42 pm
Re: Erro no código de pesquisa
Magina, estamos aqui para se ajudar, mas coloca o modelinho da planilha que possamos tentar puxar os dados também, já já passa um jedi e resolve ou tentamos também.