This is GREAT code, but I have a question:

Quote Originally Posted by mvidas View Post
[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]
I don't want to show a message box showing the url, or pop up a message box showing the underlying html (although really cool). I just want to save the URL as a string or value, and then have the URL (i.e. string or value or whatnot) write for me.

How do I do that?

Thanks!
Alex.