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

时间:2019-09-16 10:08:08

标签: vba internet-explorer

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

  

运行时错误:自动化错误,调用的对象已与其客户端断开连接

请帮助

Sub Authority()

Dim ie As Object

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

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

ie.document.getelementbyid("ComboBox29-input").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="">

1 个答案:

答案 0 :(得分:0)

IE会在更改安全区域时(例如,从Internet导航到Intranet时)打开浏览器的新实例,因此,您将丢失IE对象。您可以在IE中更改安全设置,IIRC InternetLocal intranet必须具有相同的安全级别,或/和选中enable protected mode。如果这样做不起作用,请尝试在websites in less privileged web content zone can navigate into this zone中启用custom level

相关问题