通过 VBA 预填提交 google 表单
Submiting the google form via VBA prefill
我正在尝试预填写并提交 google 表格。但是我不确定如何从我的代码中单击 google 表单上的提交按钮。
请协助解决这个问题。
使用 VBA 通过 google 表单将数据传递到 google speardsheet。
我可以在 IE 上手动单击提交按钮并保存数据。
但是通过代码做什么/如何做到这一点!!!
IE.Visible = True
IE.navigate "https://docs.google.com/forms/d/e/12344545/viewform"
Do While IE.Busy
Application.Wait DateAdd("s", 5, Now)
Loop
Set Doc = IE.document
Doc.getElementById("entry.2116136539").Value = sht.Range("A" & i).Value
Doc.getElementById("entry.451687686").Value = sht.Range("B" & i).Value
Doc.getElementById("?????????").Click
Next i
只需要提交的语法....
此循环将执行此操作:
通过标签名称span
为元素设置一个ObjCollection,然后遍历它们并得到innertext为Submit
的元素。将其分配给一个新变量并单击该元素跳出循环。
Set objCollection = Nothing
Set objCollection = IE.document.getElementsByTagName("span")
i = 0
While i < objCollection.Length
If objCollection(i).innerText = "Submit" Then
Set objElement = objCollection(i)
End If
i = i + 1
Wend
objElement.Click
我正在尝试预填写并提交 google 表格。但是我不确定如何从我的代码中单击 google 表单上的提交按钮。
请协助解决这个问题。
使用 VBA 通过 google 表单将数据传递到 google speardsheet。
我可以在 IE 上手动单击提交按钮并保存数据。
但是通过代码做什么/如何做到这一点!!!
IE.Visible = True
IE.navigate "https://docs.google.com/forms/d/e/12344545/viewform"
Do While IE.Busy
Application.Wait DateAdd("s", 5, Now)
Loop
Set Doc = IE.document
Doc.getElementById("entry.2116136539").Value = sht.Range("A" & i).Value
Doc.getElementById("entry.451687686").Value = sht.Range("B" & i).Value
Doc.getElementById("?????????").Click
Next i
只需要提交的语法....
此循环将执行此操作:
通过标签名称span
为元素设置一个ObjCollection,然后遍历它们并得到innertext为Submit
的元素。将其分配给一个新变量并单击该元素跳出循环。
Set objCollection = Nothing
Set objCollection = IE.document.getElementsByTagName("span")
i = 0
While i < objCollection.Length
If objCollection(i).innerText = "Submit" Then
Set objElement = objCollection(i)
End If
i = i + 1
Wend
objElement.Click