(Solved) – Selecting a Dropdown List Option in Google Forms Using VBA

(solved)-–-selecting-a-dropdown-list-option-in-google-forms-using-vba

we have a hudge database of people who will receive financial help on the COVID-19 situation. I’m trying to create a VBA code that allows me to fill the Google Form that will be used to collect the data: https://docs.google.com/forms/d/e/1FAIpQLSfmOe5my6a0OwGj5jOY1hFNreZCjDGLuK7qllEr18tlGxys-w/viewform.

The problem is, there’s a dropdown option in this form, and for some reason I can’t select any of the options in the list. Here’s what I’ve tried so far:

Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")

    IE.navigate "https://docs.google.com/forms/d/e/1FAIpQLSfmOe5my6a0OwGj5jOY1hFNreZCjDGLuK7qllEr18tlGxys-w/viewform"
    IE.Visible = True

    IE.document.all("entry.2084723474").InnerText = "Teste Nome"
    IE.document.all("entry.1921177593").InnerText = "37121851890"

Set HTML = IE.document
Set elements = HTML.getElementsByclassName("quantumWizMenuPaperselectOptionList")

For Each element In elements
    If element.className = "quantumWizMenuPaperselectOptionList" Then
        element.Click
    End If
Next element

Dim e
For Each e In IE.document.getElementsByTagName("span")
    If e.InnerText = "Paraisópolis (SP)" Then

        ' Found the .
        e.parentelement.Click

        Exit For

    End If
Next

In this part I found the option on the list, but when I send the command to Click in it’s parent element, nothig happens:

Dim e
For Each e In IE.document.getElementsByTagName("span")
    If e.InnerText = "Paraisópolis (SP)" Then

        ' Found the .
        e.parentelement.Click

        Exit For

    End If
Next

That’s it, any help will be very usefull to me in this moment. And I’m sorry for my terrible english.

Leave a Reply

Your email address will not be published. Required fields are marked *