我可以将 InternetExplorer.document 写入另一个 Internet Explorer window 吗?
Can I write an InternetExplorer.document to another InternetExplorer window?
我想将一个 window 的 IE.Document 带入另一个 window 的 IE.document。这能做到吗?
我看不出你的问题背后的意义。但是您可以通过这种方式做到这一点:
Sub DocFromIEtoIE()
Dim ieOne As Object
Dim ieTwo As Object
Dim nodeHTML As Object
Dim htmlDoc As String
Dim url As String
url = "https://whosebug.com/"
Set ieOne = CreateObject("internetexplorer.application")
ieOne.Visible = True
ieOne.navigate url
Do Until ieOne.ReadyState = 4: DoEvents: Loop
Set nodeHTML = ieOne.document.getElementsByTagName("html")(0)
If Not nodeHTML Is Nothing Then
htmlDoc = nodeHTML.outerHTML
Set ieTwo = CreateObject("internetexplorer.application")
ieTwo.Visible = True
ieTwo.navigate "about:blank"
Do Until ieTwo.ReadyState = 4: DoEvents: Loop
ieTwo.document.Write (htmlDoc)
End If
End Sub
我想将一个 window 的 IE.Document 带入另一个 window 的 IE.document。这能做到吗?
我看不出你的问题背后的意义。但是您可以通过这种方式做到这一点:
Sub DocFromIEtoIE()
Dim ieOne As Object
Dim ieTwo As Object
Dim nodeHTML As Object
Dim htmlDoc As String
Dim url As String
url = "https://whosebug.com/"
Set ieOne = CreateObject("internetexplorer.application")
ieOne.Visible = True
ieOne.navigate url
Do Until ieOne.ReadyState = 4: DoEvents: Loop
Set nodeHTML = ieOne.document.getElementsByTagName("html")(0)
If Not nodeHTML Is Nothing Then
htmlDoc = nodeHTML.outerHTML
Set ieTwo = CreateObject("internetexplorer.application")
ieTwo.Visible = True
ieTwo.navigate "about:blank"
Do Until ieTwo.ReadyState = 4: DoEvents: Loop
ieTwo.document.Write (htmlDoc)
End If
End Sub