如何填写网页上的文本字段?

How to fill the text field on web-page?

我需要在我公司的内部站点 SharePoint 上填写文本字段。但是当我开始我的代码时,在填充我的值之前引发下一个错误:

Run-time error: Automation Error, The interface is unknown

请帮忙

Sub Authority()

Dim ie As Object

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True

ie.navigate "OurInternalSite"

ie.document.getelementbyid("TextField5").Value = "My text"

End Sub

按钮代码

<input data-is-interactable="true" id="ComboBox29-input" class="ms-ComboBox-Input css-93" type="text" aria-expanded="false" aria-autocomplete="inline" role="combobox" spellcheck="false" autocapitalize="off" autocomplete="off" data-lpignore="true" value="">

您没有等待页面加载,这可能导致了这个错误

ie.navigate "site"
While ie.Busy Or ie.ReadyState<>4:DoEvents:Wend

input 的 ID 也是

ComboBox29-input