Excel 如何填写网上表格
我想用Excel值更新网站中的字段 我在网上找到这个宏并试图编辑它 登录成功后如何更新字段 我增加了以下参考资料:Excel 如何填写网上表格,excel,vba,internet-explorer-11,Excel,Vba,Internet Explorer 11,我想用Excel值更新网站中的字段 我在网上找到这个宏并试图编辑它 登录成功后如何更新字段 我增加了以下参考资料: Microsoft HTML对象库 Microsoft Internet控件 我试着在IE8中运行它 收到的错误: 对象“IWebBrowser2”的方法“Document”在第行失败 我更新到IE11,现在错误是: 自动错误,未指定的错误 IE.document.getelementsbyname(“\u 58\u login”).Value=“jigarjigar” 登录
- Microsoft HTML对象库
- Microsoft Internet控件
IE.document.getelementsbyname(“\u 58\u login”).Value=“jigarjigar”
登录(电子邮件)
密码
帽子锁打开了。
这是:
Do While IE.ReadyState = 4: DoEvents: Loop
应该是这样的:
Do While IE.ReadyState <> 4 Or IE.Busy: DoEvents: Loop
getElements
您尝试过吗。InnerText?实际问题是什么?非常感谢Macro Man。由于web表单填充对我来说是新的,我面临着一些问题。我更改了以下行:IE.document.getElementsByName(“\u 58\u login”)(0)。值=”jigar@jigar.com“IE.document.getElementById(“_58_password”).Value=“*******”现在我得到了错误”对象变量或未设置块变量,请提供帮助。getElementsByName
仍然不正确-应该是GetElementsByCassName
。这取决于您是否实际针对类/Id/tag属性使用哪种方法。在问题中发布html将更有助于获得“所需对象”IE.Document.getElementById(“\u 58\u password”).Value=“password”行出错。它在一个表中,这有点棘手-您将不得不尝试获取不同的HTMLCollections并遍历它们。
Do While IE.ReadyState <> 4 Or IE.Busy: DoEvents: Loop
IE.Document.getElementById("_58_login").Value
'// Class names don't have spaces in them, so the below is also wrong
IE.Document.getElementsByClassName("btn-submit nobgcolor")(0).Click
'// Or
IE.Document.Forms(0).Submit
For Each el In IE.Document.GetElementsByTagName("input")
If el.Name = "_58_login" Then
el.Value = "jigar@jigar.com"
Exit For
End If
Next
IE.Document.GetElementById("_58_password").Value = "Password"
IE.Document.GetElementsByClassName("btn-submit nobgcolor")(0).Click
'// or IE.Document.Forms(0).Submit