How to submit a google for with MSXML2.XMLHTTP Post.

MoshiM

Active Member
Joined
Jan 31, 2018
Messages
439
Office Version
  1. 2016
Platform
  1. Windows
I'm trying to submit a google form with MSXML2.XMLHTTP and keep getting an access denied error. I can submit with cURL but I want the status code.
VBA Code:
const url$ = "https://docs.google.com/forms/d/e/bunchofnumbersAndCharacters/formResponse"
const postData$ = "entry.227122838=Loc&entry.1815706984=Cit&entry.55364550=Cou&entry.1590825643=2604:3d09:927e:1100:7dd9:e011:fa9e:a4b4&entry.1917934143=Database&entry.1144002976=2024-06-18 13:10:56"

        'Shell "curl --fail -X POST -d """ & postData & """ """ & url & Chr(34)
                
        With CreateObject("MSXML2.XMLHTTP")
            .Open "POST", url, False
            .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
            .setRequestHeader "Content-Length", Len(postData)
            .send postData
            if .Status = 200 then exit sub
        End With
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top