I am trying to fill out a form in vba and will not pq?

Asked

Viewed 85 times

-1

someone knows how to fill a google Forms with vba , I got a few lines but it does not fill everything ,I can fill, no inspect elements appears filled but does not fill in the page

Public Sub ConectaWeb()
On Error Resume Next
Dim endereço As String
Dim mostra As Boolean

Dim i, n, x As Integer
endereço = "https://docs.google.com/forms/d/e/1FAIpQLSc-d6XfqSS_-P2SCRiIJMKU477NPlzFnkjVHe0RqO2DMSc4xA/viewform"
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate (endereço)
While IE.ReadyState <> 4
Wend
IE.Visible = True

IE.document.getElementsByName("entry.666457405")(0).Value = "20"
IE.document.getElementsByName("entry.1010616991")(0).Value = "30"
IE.document.getElementsByName("entry.452700562")(0).Value = "45"
IE.document.getElementsByName("entry.1857809015")(0).Value = "nome"
IE.document.getElementsByName("entry.2073241118")(0).Value = "cargo"
IE.document.getElementsByName("entry.2015582786")(0).Value = "5356645"

IE.document.forms.Item(0).submit
   
While IE.ReadyState <> 4
Wend
End Sub

1 answer

0

I could do it myself , You have to pick up the classes and determine the item in fnal after the class name because google Forms to help does not specify the fields by id or name for example id="email" or name="name"


`Public Sub ConectaWeb()
On Error Resume Next
Dim endereço As String
Dim mostra As Boolean

Dim i, n, x As Integer
endereço = "https://docs.google.com/forms/d/e/1FAIpQLSc-d6XfqSS_-P2SCRiIJMKU477NPlzFnkjVHe0RqO2DMSc4xA/viewform"
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate (endereço)
While IE.ReadyState <> 4
Wend
IE.Visible = True

'Analista Argus
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputPlaceholder exportLabel")(0).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputInput exportInput")(0).Value = "João"


'Detalhe Quantidade de ligações
IE.Document.GetElementsByClassName("quantumWizTextinputPapertextareaPlaceholder exportLabel")(0).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPapertextareaInput exportTextarea")(0).Value = "3"

'Com quem conseguiu contato
IE.Document.GetElementsByClassName("quantumWizTextinputPapertextareaPlaceholder exportLabel")(1).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPapertextareaInput exportTextarea")(1).Value = "joaozinho"

'Qual a tratativa dada pelo cliente
IE.Document.GetElementsByClassName("quantumWizTextinputPapertextareaPlaceholder exportLabel")(2).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPapertextareaInput exportTextarea")(2).Value = "nenhuma"


'Operação
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputPlaceholder exportLabel")(1).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputInput exportInput")(1).Value = "ambev"

'Frota
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputPlaceholder exportLabel")(2).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputInput exportInput")(2).Value = "fob4343"



'Tipo 1 Evento
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputPlaceholder exportLabel")(18).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputInput exportInput")(18).Value = "sonolencia"


'Tipo 2 Evento
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputPlaceholder exportLabel")(19).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputInput exportInput")(19).Value = "falso"

'Quantidade Evento tipo1
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputPlaceholder exportLabel")(20).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputInput exportInput")(20).Value = "34"

'Quantidade Evento tipo 2
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputPlaceholder exportLabel")(21).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputInput exportInput")(21).Value = "1"

'Indicador Intervenção
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputPlaceholder exportLabel")(22).innerhtml = ""
IE.Document.GetElementsByClassName("quantumWizTextinputPaperinputInput exportInput")(22).Value = "1,5"

   
While IE.ReadyState <> 4
Wend
End Sub

Browser other questions tagged

You are not signed in. Login or sign up in order to post.