Internet Explorer出现运行时错误462 [英] runtime error 462 with internet explorer

查看:114
本文介绍了Internet Explorer出现运行时错误462的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用VBA从excel访问网页.我可以启动Internet Explorer,然后看到该网页,但是当我点击Do Before internet.ReadyState> = 4行代码时,出现运行时错误462.有任何想法吗?最终,我希望能够解析一个站点并获得该站点上的链接列表并选择一个,然后单击"该链接.建议和帮助会很棒.这是我正在使用的功能(我在网上找到的):

I am trying to access a webpage from excel using VBA. I can get internet explorer to launch, and I see the webpage come up, but I get a runtime error 462 when I hit the Do Until internet.ReadyState >= 4 line of code. any ideas? ultimately I want to be able to parse a site and get a list of the links on that site and pick one, and then "click" on that link. suggestions and help would be great. here is the function (that I found on the web) that I am using:

Public Sub clicklick()

Dim internet As Object
Dim internetdata As Object
Dim div_result As Object
Dim header_links As Object
Dim link As Object
Dim URL As String

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

URL = "https://www.google.co.in/search?q=how+to+program+in+vba"
internet.Navigate URL


Do Until internet.ReadyState >= 4
    DoEvents
Loop

Application.Wait Now + TimeSerial(0, 0, 5)

Set internetdata = internet.Document
Set div_result = internetdata.getelementbyid("res")


Set header_links = div_result.getelementsbytagname("h3")

For Each h In header_links
    Set link = h.ChildNodes.Item(0)
    Cells(Range("A" & Rows.count).End(xlUp).row + 1, 1) = link.href
Next

MsgBox "done"

End Sub

谢谢你,丙氨酸

推荐答案

我在VBA和使用 Set objIE = New InternetExplorerMedium 代替 Set objIE = CreateObject("InternetExplorer.Application")不能解决问题.我通过转到IE设置-> Internet选项->安全并取消选中启用保护模式"选项

I had a similar error with VBA and using Set objIE = New InternetExplorerMedium instead of Set objIE = CreateObject("InternetExplorer.Application") did not solve the problem. I solved the issue by going to IE Settings -> Internet Options -> Security and unchecking the "Enable protected Mode" option

这篇关于Internet Explorer出现运行时错误462的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆