我試圖用VBA腳本中的一些值來提交一個Microsoft表格,這樣當一天中發生一些特定的事情時,我就可以一次性查看所有發生的情況。我已經在 IE 中打開了它,將值放入框中,然后提交,但值似乎并沒有保存。
我想知道,在設定問題值時,我是否可以做一些不同的事情
。Sub Init_app3()
Dim IE As InternetExplorer
Dim URL As String
Dim問題 As Object
Dim btnGo As Object
Set IE = CreateObject("InternetExplorer.Application" )
IE.Visible = True[/span]。
URL = "https://forms.office.com/r/mvT5hD1RRT"/span>
IE.navigate (URL)
Do
辦事
Loop Until IE.readyState = 4
Set question = IE.document.getElementsByClassName("office-form-question-textbox office-form-textfield-input form-control office-form-theme-focus-border border-no-radius")(0)
With問題
.value = "MALE"
結束 有
Set btnGo = IE.document.getElementsByClassName("button-content"/span>)(0)
延遲 5(5)
With btnGo
.點擊
結束 具有
延遲5。
IE.Quit
Set IE = Nothing
Exit Sub
End Sub
uj5u.com熱心網友回復:
當我用自己的Microsoft Form測驗時,我可以重現這個問題。似乎question.value不能有效地給輸入框設定一個值。在這種情況下,你可以使用SendKeys模擬用戶輸入,為輸入框設定值。
你可以把設定問題值的代碼塊改成下面的樣子,我已經測驗過了,它能正確地設定和保存值:
Set question = IE.document. getElementsByClassName("office-form-question-textbox office-form-textfield-input form-control office-form-theme-focus-border border-no-radius")(0)
問題.焦點
SendKeys ("MALE")
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/320211.html
標籤:
