Irf*_*ikh 5 excel iframe vba excel-vba
我陷入了使用vba访问iframe的contentwindow的问题。使用iframe.domain = document.domain进行检查时,框架位于相同的域中。以下是到目前为止我尝试过的。我阅读了所有网站,但找不到解决方法。简化同一域/跨域消息传递的任何其他方法都是高度可取的。
Dim ie As New InternetExplorer
Dim objshell, objshellwindows
Dim doc As MSHTML.HTMLDocument
Dim doc1 As MSHTML.IHTMLDocument
Dim iframe As MSHTML.HTMLIFrame
Set objshell = CreateObject("Shell.Application")
Set objshellwindows = objshell.Windows
For Each ie In objshellwindows
If InStr(ie.LocationURL, "http://www.example.com/examples/camera/html/index.html") > 0 Then
Set doc = ie.document
For Each iframe In doc.getElementsByTagName("IFRAME")
Set doc1 = iframe.contentWindow.document '---Access Denied/ Permission Denied Error
Next
End If
Next
| 归档时间: |
|
| 查看次数: |
1918 次 |
| 最近记录: |