PDA

View Full Version : finding active inernet url



buhay
11-23-2010, 02:32 PM
Does anyone know how to find the active internet url with a macro to display it in a cell or msgbox?

omnibuster
05-29-2011, 02:06 PM
Private Sub CommandButton1_Click()
'Reference needed for Microsoft Internet Controls
Dim SWs As SHDocVw.ShellWindows
Dim i As Long, Adres As String
Set SWs = New SHDocVw.ShellWindows
For i = SWs.Count - 1 To 0 Step -1
Adres = CStr(SWs(i).LocationURL)
If Adres Like "http*" Then
Range("A1").Hyperlinks.Add Anchor:=Range("A1"), Address:=Adres, TextToDisplay:=Adres
End If
Next i
Range("A1").Activate
Set SWs = Nothing
End Sub

jasoncw
06-02-2011, 11:49 AM
sorry, delete post