[英]Accessing a Variant/Object/JScriptTypeInfo property in VBA
[英]Method 'frames' of object 'JScriptTypeInfo' failed
我正在通过excel VBA进行Internet Explorer 9的自动化,当我到达下面的最后一行时,它将引发错误:
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "https://example.com/Main.asp"
'delay till readystate is complete
Set doc = ie.document
Set doc1 = doc.frames(2).document 'here comes the error
谁能帮忙吗?
我遇到了同样的问题,并且解决了
这将适用于IE 10+
设置doc = ie.document.frames
设置doc1 = doc.frames(2)
对于脚本元素,不再支持readyState。 从Internet Explorer 11开始,使用onload
迁移到IE11后,我在一些Excel VBA代码中遇到了相同的问题。 这是我必须解决的问题:
旧代码在IE8中有效,但在IE11中引发错误
Set objCollection = IE.Document.frames(0).Document.getElementsByTagName("span")
在IE11中有效的新代码(我必须在工具/引用下添加对Microsoft HTML对象库的引用)
Dim htmlDoc As MSHTML.HTMLDocument
Dim htmlWindow As MSHTML.HTMLWindow2
Set htmlDoc = IE.Document
Set htmlWindow = htmlDoc.frames(0)
Set objCollection = htmlWindow.Document.getElementsByTagName("span")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.