
Originally Posted by
mvidas
[vba]Sub GetIEWindows()
'Requires reference to Microsoft Internet Controls
Dim SWs As SHDocVw.ShellWindows, vIE As SHDocVw.InternetExplorer
'Establish link to IE application
Set SWs = New SHDocVw.ShellWindows
For Each vIE In SWs
If Left(vIE.LocationURL, 4) = "http" Then 'avoid explorer windows/etc this way
If MsgBox("IE Window found. The URL is:" & vbCrLf & vIE.LocationURL & vbCrLf & _
vbCrLf & "Do you want to see the html?", vbYesNo) = vbYes Then
'Show html in a msgbox
MsgBox vIE.Document.Body.innerHTML
'Or put it to a file
'dim vFF as long
'vff=freefile
'open "C:\thehtml.txt" for output as #vff
'print #vff,vie.document.body.innerhtml
'close #vff
End If
End If
Next
Set SWs = Nothing
Set vIE = Nothing
End Sub[/vba]