Pass IE web address to Excel
"grove" wrote in message
...
I want to be able to send the current IE web address to Excel each
time the web address changes. Ideally with the ability to add a
comment in an adjacent cell.
Can I do this with IE running from within Excel? Any snippets of vba
code or ideas how to do this appreciated.
Add a reference to "Microsoft Internet Controls"
(shdocvw.dll)
If you (for instance) have two text boxes on a form - for the web address
and comment.
In the form code...
'declare a variable like this
Dim WithEvents ie As SHDocVw.InternetExplorer
'open the browser like this
Set ie = New InternetExplorer
ie.Visible = True
'when this event fires, it will put the current url in textbox1
Private Sub ie_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
TextBox1.Value = ie.LocationURL
End Sub
--
roger
|