Converter código de leitura da Internet Explorer para Google Chrome [RESOLVIDO]
Enviado: Ter Set 24, 2019 3:09 pm
Boa tarde!
Pessoal, uma duvida, seria possível alterar o código abaixo para que ele faça toda a pesquisa, preenchimento e retorno do formulário através da tela do Google Chrome?
Não estou conseguindo!
Aliás, esse código já funciona, mas queria perguntar se vocês tem alguma dica para melhora-lo !
--------------------------------------------
Sub Cotação()
Dim MyDate
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 = Range("F8")
IE.document.getElementById("input_cotacao").Value = Range("C6")
IE.document.getElementById("input_destino").Value = Range("C22")
IE.document.getElementById("input_cotacao_2").Value = ("1")
IE.document.getElementById("input_destino_1").Value = Range("C8")
IE.document.getElementById("select_produto").Value = Range("F6")
IE.document.getElementById("input_entrega").Click
Set target = Range("G15")
If target.Value = "SIM" Then
IE.document.getElementById("input_valor_nota").Value = Range("F15")
IE.document.getElementById("input_seguro").Click
End If
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
End With
Invalido:
MsgBox "Valor disponível"
End Sub
Pessoal, uma duvida, seria possível alterar o código abaixo para que ele faça toda a pesquisa, preenchimento e retorno do formulário através da tela do Google Chrome?
Não estou conseguindo!
Aliás, esse código já funciona, mas queria perguntar se vocês tem alguma dica para melhora-lo !
--------------------------------------------
Sub Cotação()
Dim MyDate
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 = Range("F8")
IE.document.getElementById("input_cotacao").Value = Range("C6")
IE.document.getElementById("input_destino").Value = Range("C22")
IE.document.getElementById("input_cotacao_2").Value = ("1")
IE.document.getElementById("input_destino_1").Value = Range("C8")
IE.document.getElementById("select_produto").Value = Range("F6")
IE.document.getElementById("input_entrega").Click
Set target = Range("G15")
If target.Value = "SIM" Then
IE.document.getElementById("input_valor_nota").Value = Range("F15")
IE.document.getElementById("input_seguro").Click
End If
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
End With
Invalido:
MsgBox "Valor disponível"
End Sub